| 1 | import { botConnectionLabel } from "../components/botConnectionSettings"; |
| 2 | import type { useT } from "../lib/i18n"; |
| 3 | import type { BotConnectionView } from "../lib/types"; |
| 4 | |
| 5 | const t = ((key: string) => key === "settings.botDingtalk" ? "DingTalk" : key) as ReturnType<typeof useT>; |
| 6 | const connection = { |
| 7 | provider: "dingtalk", |
| 8 | domain: "dingtalk", |
| 9 | } as BotConnectionView; |
| 10 | |
| 11 | const label = botConnectionLabel(connection, t); |
| 12 | if (label !== "DingTalk") { |
| 13 | throw new Error(`DingTalk connection label = ${JSON.stringify(label)}, want \"DingTalk\"`); |
| 14 | } |
| 15 | |
| 16 | console.log("bot connection settings: DingTalk label passed"); |
| 17 |