test(matrix): update repair bootstrap test to assert passwordless bots are repaired

This commit is contained in:
SARAMALI15792
2026-04-14 04:05:02 +05:00
committed by Gustavo Madeira Santana
parent 17a593fe1c
commit 4200c9e837

View File

@@ -1284,16 +1284,24 @@ describe("MatrixClient crypto bootstrapping", () => {
});
});
it("does not force-reset bootstrap when password is unavailable", async () => {
it("attempts repair bootstrap even when no password is configured", async () => {
matrixJsClient.getCrypto = vi.fn(() => ({ on: vi.fn() }));
const client = new MatrixClient("https://matrix.example.org", "token", {
encryption: true,
// no password — passwordless token-auth bot
});
const bootstrapSpy = vi.fn().mockResolvedValue({
crossSigningReady: false,
crossSigningPublished: false,
ownDeviceVerified: false,
});
const bootstrapSpy = vi
.fn()
.mockResolvedValueOnce({
crossSigningReady: false,
crossSigningPublished: false,
ownDeviceVerified: false,
})
.mockResolvedValueOnce({
crossSigningReady: true,
crossSigningPublished: true,
ownDeviceVerified: true,
});
await (
client as unknown as {
ensureCryptoSupportInitialized: () => Promise<void>;
@@ -1307,7 +1315,12 @@ describe("MatrixClient crypto bootstrapping", () => {
await client.start();
expect(bootstrapSpy).toHaveBeenCalledTimes(1);
expect(bootstrapSpy).toHaveBeenCalledTimes(2);
expect((bootstrapSpy.mock.calls as unknown[][])[1]?.[1] ?? {}).toEqual({
forceResetCrossSigning: true,
allowSecretStorageRecreateWithoutRecoveryKey: true,
strict: true,
});
});
it("provides secret storage callbacks and resolves stored recovery key", async () => {