mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 22:02:05 +00:00
test: tighten matrix startup profile sync assertion
This commit is contained in:
@@ -154,13 +154,26 @@ describe("runMatrixStartupMaintenance", () => {
|
||||
|
||||
await runMatrixStartupMaintenance(params, deps);
|
||||
|
||||
expect(deps.syncMatrixOwnProfile).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
userId: "@bot:example.org",
|
||||
displayName: "Ops Bot",
|
||||
avatarUrl: "https://example.org/avatar.png",
|
||||
}),
|
||||
);
|
||||
expect(deps.syncMatrixOwnProfile).toHaveBeenCalledTimes(1);
|
||||
const [profileSyncParams] = vi.mocked(deps.syncMatrixOwnProfile).mock.calls[0] ?? [];
|
||||
if (!profileSyncParams) {
|
||||
throw new Error("profile sync params missing");
|
||||
}
|
||||
expect(profileSyncParams).toStrictEqual({
|
||||
client: params.client,
|
||||
userId: "@bot:example.org",
|
||||
displayName: "Ops Bot",
|
||||
avatarUrl: "https://example.org/avatar.png",
|
||||
loadAvatarFromUrl: profileSyncParams.loadAvatarFromUrl,
|
||||
});
|
||||
await expect(
|
||||
profileSyncParams.loadAvatarFromUrl("https://example.org/new-avatar.png", 123),
|
||||
).resolves.toStrictEqual({
|
||||
buffer: Buffer.from("avatar"),
|
||||
contentType: "image/png",
|
||||
fileName: "avatar.png",
|
||||
});
|
||||
expect(params.loadWebMedia).toHaveBeenCalledWith("https://example.org/new-avatar.png", 123);
|
||||
expect(deps.updateMatrixAccountConfig).toHaveBeenCalledWith(
|
||||
{ channels: { matrix: {} } },
|
||||
"ops",
|
||||
|
||||
Reference in New Issue
Block a user