test: tighten mattermost helper payload assertions · openclaw/openclaw@8adf270
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 |
|---|
@@ -160,13 +160,9 @@ describe("mattermost directory", () => {
|
160 | 160 | }), |
161 | 161 | ).resolves.toEqual([{ kind: "user", id: "user:user-1", name: "alice", handle: "Alice Ng" }]); |
162 | 162 | |
163 | | -expect(client.request).toHaveBeenNthCalledWith( |
164 | | -2, |
165 | | -"/users/search", |
166 | | -expect.objectContaining({ |
167 | | -method: "POST", |
168 | | -body: JSON.stringify({ term: "ali", team_id: "team-1" }), |
169 | | -}), |
170 | | -); |
| 163 | +expect(client.request).toHaveBeenNthCalledWith(2, "/users/search", { |
| 164 | +method: "POST", |
| 165 | +body: JSON.stringify({ term: "ali", team_id: "team-1" }), |
| 166 | +}); |
171 | 167 | }); |
172 | 168 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -120,14 +120,10 @@ describe("mattermost monitor resources", () => {
|
120 | 120 | message: "Pick a model", |
121 | 121 | }); |
122 | 122 | |
123 | | -expect(updateMattermostPost).toHaveBeenCalledWith( |
124 | | -{}, |
125 | | -"post-1", |
126 | | -expect.objectContaining({ |
127 | | -message: "Pick a model", |
128 | | -props: { attachments: [] }, |
129 | | -}), |
130 | | -); |
| 123 | +expect(updateMattermostPost).toHaveBeenCalledWith({}, "post-1", { |
| 124 | +message: "Pick a model", |
| 125 | +props: { attachments: [] }, |
| 126 | +}); |
131 | 127 | }); |
132 | 128 | |
133 | 129 | it("proxies typing indicators to the mattermost client helper", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -131,14 +131,13 @@ describe("mattermost monitor slash", () => {
|
131 | 131 | originalName: "oc_ping", |
132 | 132 | }, |
133 | 133 | ]); |
134 | | -expect(activateSlashCommands).toHaveBeenCalledWith( |
135 | | -expect.objectContaining({ |
136 | | -commandTokens: ["token-1", "token-2"], |
137 | | -triggerMap: new Map([ |
138 | | -["oc_skill", "skill"], |
139 | | -["oc_ping", "oc_ping"], |
140 | | -]), |
141 | | -}), |
| 134 | +const [activation] = activateSlashCommands.mock.calls[0] ?? []; |
| 135 | +expect(activation?.commandTokens).toStrictEqual(["token-1", "token-2"]); |
| 136 | +expect(activation?.triggerMap).toStrictEqual( |
| 137 | +new Map([ |
| 138 | +["oc_skill", "skill"], |
| 139 | +["oc_ping", "oc_ping"], |
| 140 | +]), |
142 | 141 | ); |
143 | 142 | expect(runtime.log).toHaveBeenCalledWith( |
144 | 143 | "mattermost: slash commands registered (2 commands across 2 teams, callback=https://openclaw.test/slash)", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。