mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 17:20:46 +00:00
test: tighten mattermost config assertions
This commit is contained in:
@@ -70,9 +70,14 @@ describe("mattermost setup contract", () => {
|
||||
},
|
||||
expectedAccountId: "default",
|
||||
assertPatchedConfig: (cfg) => {
|
||||
expect(cfg.channels?.mattermost?.enabled).toBe(true);
|
||||
expect(cfg.channels?.mattermost?.botToken).toBe("test-token");
|
||||
expect(cfg.channels?.mattermost?.baseUrl).toBe("https://chat.example.com");
|
||||
const mattermostConfig = cfg.channels?.mattermost;
|
||||
expect(mattermostConfig).toBeDefined();
|
||||
if (!mattermostConfig) {
|
||||
throw new Error("expected Mattermost config patch");
|
||||
}
|
||||
expect(mattermostConfig.enabled).toBe(true);
|
||||
expect(mattermostConfig.botToken).toBe("test-token");
|
||||
expect(mattermostConfig.baseUrl).toBe("https://chat.example.com");
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -30,16 +30,17 @@ describe("mattermost doctor", () => {
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(result.config.channels?.mattermost?.network).toEqual({
|
||||
const mattermostConfig = result.config.channels?.mattermost;
|
||||
expect(mattermostConfig).toBeDefined();
|
||||
if (!mattermostConfig) {
|
||||
throw new Error("expected normalized Mattermost config");
|
||||
}
|
||||
expect(mattermostConfig.network).toEqual({
|
||||
dangerouslyAllowPrivateNetwork: true,
|
||||
});
|
||||
expect(
|
||||
(
|
||||
result.config.channels?.mattermost?.accounts?.work as
|
||||
| { network?: Record<string, unknown> }
|
||||
| undefined
|
||||
)?.network,
|
||||
).toEqual({
|
||||
const workAccount = mattermostConfig.accounts?.work as { network?: Record<string, unknown> };
|
||||
expect(workAccount).toBeDefined();
|
||||
expect(workAccount.network).toEqual({
|
||||
dangerouslyAllowPrivateNetwork: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -391,8 +391,13 @@ describe("mattermost setup", () => {
|
||||
([params]) => (params as { message: string }).message,
|
||||
);
|
||||
expect(textMessages).toEqual(["Enter Mattermost bot token", "Enter Mattermost base URL"]);
|
||||
expect(result.cfg.channels?.mattermost?.botToken).toBe("bot-token");
|
||||
expect(result.cfg.channels?.mattermost?.baseUrl).toBe("https://chat.example.com");
|
||||
const mattermostConfig = result.cfg.channels?.mattermost;
|
||||
expect(mattermostConfig).toBeDefined();
|
||||
if (!mattermostConfig) {
|
||||
throw new Error("expected Mattermost config");
|
||||
}
|
||||
expect(mattermostConfig.botToken).toBe("bot-token");
|
||||
expect(mattermostConfig.baseUrl).toBe("https://chat.example.com");
|
||||
expect(result.accountId).toBe(DEFAULT_ACCOUNT_ID);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user