test: tighten matrix startup profile sync assertion · openclaw/openclaw@0f72694
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -154,13 +154,26 @@ describe("runMatrixStartupMaintenance", () => {
|
154 | 154 | |
155 | 155 | await runMatrixStartupMaintenance(params, deps); |
156 | 156 | |
157 | | -expect(deps.syncMatrixOwnProfile).toHaveBeenCalledWith( |
158 | | -expect.objectContaining({ |
159 | | -userId: "@bot:example.org", |
160 | | -displayName: "Ops Bot", |
161 | | -avatarUrl: "https://example.org/avatar.png", |
162 | | -}), |
163 | | -); |
| 157 | +expect(deps.syncMatrixOwnProfile).toHaveBeenCalledTimes(1); |
| 158 | +const [profileSyncParams] = vi.mocked(deps.syncMatrixOwnProfile).mock.calls[0] ?? []; |
| 159 | +if (!profileSyncParams) { |
| 160 | +throw new Error("profile sync params missing"); |
| 161 | +} |
| 162 | +expect(profileSyncParams).toStrictEqual({ |
| 163 | +client: params.client, |
| 164 | +userId: "@bot:example.org", |
| 165 | +displayName: "Ops Bot", |
| 166 | +avatarUrl: "https://example.org/avatar.png", |
| 167 | +loadAvatarFromUrl: profileSyncParams.loadAvatarFromUrl, |
| 168 | +}); |
| 169 | +await expect( |
| 170 | +profileSyncParams.loadAvatarFromUrl("https://example.org/new-avatar.png", 123), |
| 171 | +).resolves.toStrictEqual({ |
| 172 | +buffer: Buffer.from("avatar"), |
| 173 | +contentType: "image/png", |
| 174 | +fileName: "avatar.png", |
| 175 | +}); |
| 176 | +expect(params.loadWebMedia).toHaveBeenCalledWith("https://example.org/new-avatar.png", 123); |
164 | 177 | expect(deps.updateMatrixAccountConfig).toHaveBeenCalledWith( |
165 | 178 | { channels: { matrix: {} } }, |
166 | 179 | "ops", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。