test: tighten mattermost slash state assertions · openclaw/openclaw@e3b5e28
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
File tree
extensions/mattermost/src/mattermost
| Original file line number | Diff line number | Diff line change |
|---|
@@ -58,7 +58,13 @@ describe("slash-state token routing", () => {
|
58 | 58 | }); |
59 | 59 | |
60 | 60 | const match = resolveSlashHandlerForToken("tok-a"); |
61 | | -expect(match).toMatchObject({ kind: "single", source: "token", accountIds: ["a1"] }); |
| 61 | +expect(match.kind).toBe("single"); |
| 62 | +if (match.kind !== "single") { |
| 63 | +throw new Error("expected single match"); |
| 64 | +} |
| 65 | +expect(match.source).toBe("token"); |
| 66 | +expect(match.accountIds).toEqual(["a1"]); |
| 67 | +expect(typeof match.handler).toBe("function"); |
62 | 68 | }); |
63 | 69 | |
64 | 70 | it("returns ambiguous when same token exists in multiple accounts", () => { |
@@ -99,7 +105,13 @@ describe("slash-state token routing", () => {
|
99 | 105 | command: "/oc_status", |
100 | 106 | }); |
101 | 107 | |
102 | | -expect(match).toMatchObject({ kind: "single", source: "command", accountIds: ["a1"] }); |
| 108 | +expect(match.kind).toBe("single"); |
| 109 | +if (match.kind !== "single") { |
| 110 | +throw new Error("expected single match"); |
| 111 | +} |
| 112 | +expect(match.source).toBe("command"); |
| 113 | +expect(match.accountIds).toEqual(["a1"]); |
| 114 | +expect(typeof match.handler).toBe("function"); |
103 | 115 | }); |
104 | 116 | |
105 | 117 | it("returns ambiguous when registered team and command match multiple accounts", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。