fix(matrix): move avatar setup into account config (#61437)

Merged via squash.

Prepared head SHA: 4dd887a474
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-04-05 14:57:44 -04:00
committed by GitHub
parent bcc0e3de2e
commit cac40c01e9
9 changed files with 201 additions and 80 deletions

View File

@@ -607,6 +607,49 @@ describe("matrix CLI verification commands", () => {
);
});
it("forwards --avatar-url through account add setup and profile sync", async () => {
matrixRuntimeLoadConfigMock.mockReturnValue({ channels: {} });
const program = buildProgram();
await program.parseAsync(
[
"matrix",
"account",
"add",
"--name",
"Ops Bot",
"--homeserver",
"https://matrix.example.org",
"--access-token",
"ops-token",
"--avatar-url",
"mxc://example/ops-avatar",
],
{ from: "user" },
);
expect(matrixSetupApplyAccountConfigMock).toHaveBeenCalledWith(
expect.objectContaining({
accountId: "ops-bot",
input: expect.objectContaining({
name: "Ops Bot",
homeserver: "https://matrix.example.org",
accessToken: "ops-token",
avatarUrl: "mxc://example/ops-avatar",
}),
}),
);
expect(updateMatrixOwnProfileMock).toHaveBeenCalledWith(
expect.objectContaining({
accountId: "ops-bot",
displayName: "Ops Bot",
avatarUrl: "mxc://example/ops-avatar",
}),
);
expect(console.log).toHaveBeenCalledWith("Saved matrix account: ops-bot");
expect(console.log).toHaveBeenCalledWith("Config path: channels.matrix.accounts.ops-bot");
});
it("sets profile name and avatar via profile set command", async () => {
const program = buildProgram();