@@ -8,6 +8,15 @@ import {
|
8 | 8 | |
9 | 9 | const { prepareSecretsRuntimeSnapshot } = setupSecretsRuntimeSnapshotTestHooks(); |
10 | 10 | |
| 11 | +function requireZaloConfig(snapshot: Awaited<ReturnType<typeof prepareSecretsRuntimeSnapshot>>) { |
| 12 | +const config = snapshot.config.channels?.zalo; |
| 13 | +expect(config).toBeDefined(); |
| 14 | +if (!config) { |
| 15 | +throw new Error("expected Zalo runtime config"); |
| 16 | +} |
| 17 | +return config; |
| 18 | +} |
| 19 | + |
11 | 20 | describe("secrets runtime snapshot zalo token activity", () => { |
12 | 21 | it("treats top-level Zalo botToken refs as active even when tokenFile is configured", async () => { |
13 | 22 | const snapshot = await prepareSecretsRuntimeSnapshot({ |
@@ -26,7 +35,7 @@ describe("secrets runtime snapshot zalo token activity", () => {
|
26 | 35 | loadAuthStore: () => loadAuthStoreWithProfiles({}), |
27 | 36 | }); |
28 | 37 | |
29 | | -expect(snapshot.config.channels?.zalo?.botToken).toBe("resolved-zalo-token"); |
| 38 | +expect(requireZaloConfig(snapshot).botToken).toBe("resolved-zalo-token"); |
30 | 39 | expect(snapshot.warnings.map((warning) => warning.path)).not.toContain( |
31 | 40 | "channels.zalo.botToken", |
32 | 41 | ); |
@@ -83,7 +92,7 @@ describe("secrets runtime snapshot zalo token activity", () => {
|
83 | 92 | loadAuthStore: () => loadAuthStoreWithProfiles({}), |
84 | 93 | }); |
85 | 94 | |
86 | | -expect(snapshot.config.channels?.zalo?.botToken).toBe("resolved-zalo-top-level-token"); |
| 95 | +expect(requireZaloConfig(snapshot).botToken).toBe("resolved-zalo-top-level-token"); |
87 | 96 | expect(snapshot.warnings.map((warning) => warning.path)).not.toContain( |
88 | 97 | "channels.zalo.botToken", |
89 | 98 | ); |
|