Skip to content

Commit 69db213

Browse files
authored
Remove usage of legacy crypto in integ tests (#4669)
1 parent 2558903 commit 69db213

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

spec/unit/matrix-client.spec.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ import {
3131
UNSTABLE_MSC3088_PURPOSE,
3232
UNSTABLE_MSC3089_TREE_SUBTYPE,
3333
} from "../../src/@types/event";
34-
import { MEGOLM_ALGORITHM } from "../../src/crypto/olmlib";
35-
import { Crypto } from "../../src/crypto";
3634
import { EventStatus, MatrixEvent } from "../../src/models/event";
3735
import { Preset } from "../../src/@types/partials";
3836
import { ReceiptType } from "../../src/@types/read_receipts";
@@ -76,6 +74,7 @@ import { ServerSideSecretStorageImpl } from "../../src/secret-storage";
7674
import { KnownMembership } from "../../src/@types/membership";
7775
import { RoomMessageEventContent } from "../../src/@types/events";
7876
import { mockOpenIdConfiguration } from "../test-utils/oidc.ts";
77+
import { CryptoBackend } from "../../src/common-crypto/CryptoBackend";
7978

8079
jest.useFakeTimers();
8180

@@ -1188,7 +1187,7 @@ describe("MatrixClient", function () {
11881187
type: EventType.RoomEncryption,
11891188
state_key: "",
11901189
content: {
1191-
algorithm: MEGOLM_ALGORITHM,
1190+
algorithm: "m.megolm.v1.aes-sha2",
11921191
},
11931192
},
11941193
],
@@ -1914,7 +1913,7 @@ describe("MatrixClient", function () {
19141913
hasEncryptionStateEvent: jest.fn().mockReturnValue(true),
19151914
} as unknown as Room;
19161915

1917-
let mockCrypto: Mocked<Crypto>;
1916+
let mockCrypto: Mocked<CryptoBackend>;
19181917

19191918
let event: MatrixEvent;
19201919
beforeEach(async () => {
@@ -1934,7 +1933,7 @@ describe("MatrixClient", function () {
19341933
isEncryptionEnabledInRoom: jest.fn().mockResolvedValue(true),
19351934
encryptEvent: jest.fn(),
19361935
stop: jest.fn(),
1937-
} as unknown as Mocked<Crypto>;
1936+
} as unknown as Mocked<CryptoBackend>;
19381937
client["cryptoBackend"] = mockCrypto;
19391938
});
19401939

spec/unit/room.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ import { UNSTABLE_ELEMENT_FUNCTIONAL_USERS } from "../../src/@types/event";
5353
import { TestClient } from "../TestClient";
5454
import { ReceiptType, WrappedReceipt } from "../../src/@types/read_receipts";
5555
import { FeatureSupport, Thread, THREAD_RELATION_TYPE, ThreadEvent } from "../../src/models/thread";
56-
import { Crypto } from "../../src/crypto";
5756
import * as threadUtils from "../test-utils/thread";
5857
import { getMockClientWithEventEmitter, mockClientMethodsUser } from "../test-utils/client";
5958
import { logger } from "../../src/logger";
6059
import { flushPromises } from "../test-utils/flushPromises";
6160
import { KnownMembership } from "../../src/@types/membership";
61+
import { CryptoBackend } from "../../src/common-crypto/CryptoBackend";
6262

6363
describe("Room", function () {
6464
const roomId = "!foo:bar";
@@ -3776,7 +3776,7 @@ describe("Room", function () {
37763776
const client = new TestClient(userA).client;
37773777
client["cryptoBackend"] = {
37783778
decryptEvent: jest.fn().mockResolvedValue({ clearEvent: { body: "enc" } }),
3779-
} as unknown as Crypto;
3779+
} as unknown as CryptoBackend;
37803780
client.store.getPendingEvents = jest.fn(async (roomId) => [
37813781
{
37823782
event_id: "$1:server",

0 commit comments

Comments
 (0)