Remove references to MatrixClient.crypto
(#28204)
* Remove `VerificationExplorer` * Remove `remakeolm` slash command * Remove call to `crypto.cancelAndResendAllOutgoingKeyRequests` * Remove crypto mock in `LoginWithQR-test.tsx` * Remove `StopGadWidgetDriver.sendToDevice` * Remove remaining mock
This commit is contained in:
parent
ea5cba3649
commit
7236953d07
12 changed files with 0 additions and 380 deletions
|
@ -119,11 +119,6 @@ export function createTestClient(): MatrixClient {
|
|||
removeRoom: jest.fn(),
|
||||
},
|
||||
|
||||
crypto: {
|
||||
deviceList: {
|
||||
downloadKeys: jest.fn(),
|
||||
},
|
||||
},
|
||||
getCrypto: jest.fn().mockReturnValue({
|
||||
getOwnDeviceKeys: jest.fn(),
|
||||
getUserDeviceInfo: jest.fn(),
|
||||
|
|
|
@ -236,50 +236,6 @@ describe("SlashCommands", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("/remakeolm", () => {
|
||||
beforeEach(() => {
|
||||
command = findCommand("remakeolm")!;
|
||||
});
|
||||
|
||||
describe("isEnabled", () => {
|
||||
describe("when developer mode is enabled", () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName: string) => {
|
||||
if (settingName === "developerMode") return true;
|
||||
});
|
||||
});
|
||||
|
||||
it("should return true for Room", () => {
|
||||
setCurrentRoom();
|
||||
expect(command.isEnabled(client)).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for LocalRoom", () => {
|
||||
setCurrentLocalRoom();
|
||||
expect(command.isEnabled(client)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when developer mode is not enabled", () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName: string) => {
|
||||
if (settingName === "developerMode") return false;
|
||||
});
|
||||
});
|
||||
|
||||
it("should return false for Room", () => {
|
||||
setCurrentRoom();
|
||||
expect(command.isEnabled(client)).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for LocalRoom", () => {
|
||||
setCurrentLocalRoom();
|
||||
expect(command.isEnabled(client)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("/part", () => {
|
||||
it("should part room matching alias if found", async () => {
|
||||
const room1 = new Room("room-id", client, client.getSafeUserId());
|
||||
|
|
|
@ -75,11 +75,6 @@ exports[`DevtoolsDialog renders the devtools dialog 1`] = `
|
|||
>
|
||||
Notifications debug
|
||||
</button>
|
||||
<button
|
||||
class="mx_DevTools_button"
|
||||
>
|
||||
Verification explorer
|
||||
</button>
|
||||
<button
|
||||
class="mx_DevTools_button"
|
||||
>
|
||||
|
|
|
@ -51,7 +51,6 @@ function makeClient() {
|
|||
},
|
||||
getClientWellKnown: jest.fn().mockReturnValue({}),
|
||||
getCrypto: jest.fn().mockReturnValue({}),
|
||||
crypto: {},
|
||||
} as unknown as MatrixClient);
|
||||
}
|
||||
|
||||
|
@ -194,7 +193,6 @@ describe("<LoginWithQR />", () => {
|
|||
});
|
||||
|
||||
test("approve - no crypto", async () => {
|
||||
(client as any).crypto = undefined;
|
||||
(client as any).getCrypto = () => undefined;
|
||||
const onFinished = jest.fn();
|
||||
render(getComponent({ client, onFinished }));
|
||||
|
|
|
@ -18,7 +18,6 @@ import {
|
|||
MsgType,
|
||||
RelationType,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo";
|
||||
import {
|
||||
Widget,
|
||||
MatrixWidgetType,
|
||||
|
@ -171,54 +170,6 @@ describe("StopGapWidgetDriver", () => {
|
|||
expect(listener).toHaveBeenCalledWith(openIdUpdate);
|
||||
});
|
||||
|
||||
describe("sendToDevice", () => {
|
||||
const contentMap = {
|
||||
"@alice:example.org": {
|
||||
"*": {
|
||||
hello: "alice",
|
||||
},
|
||||
},
|
||||
"@bob:example.org": {
|
||||
bobDesktop: {
|
||||
hello: "bob",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let driver: WidgetDriver;
|
||||
|
||||
beforeEach(() => {
|
||||
driver = mkDefaultDriver();
|
||||
});
|
||||
|
||||
it("sends unencrypted messages", async () => {
|
||||
await driver.sendToDevice("org.example.foo", false, contentMap);
|
||||
expect(client.queueToDevice.mock.calls).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("sends encrypted messages", async () => {
|
||||
const aliceWeb = new DeviceInfo("aliceWeb");
|
||||
const aliceMobile = new DeviceInfo("aliceMobile");
|
||||
const bobDesktop = new DeviceInfo("bobDesktop");
|
||||
|
||||
mocked(client.crypto!.deviceList).downloadKeys.mockResolvedValue(
|
||||
new Map([
|
||||
[
|
||||
"@alice:example.org",
|
||||
new Map([
|
||||
["aliceWeb", aliceWeb],
|
||||
["aliceMobile", aliceMobile],
|
||||
]),
|
||||
],
|
||||
["@bob:example.org", new Map([["bobDesktop", bobDesktop]])],
|
||||
]),
|
||||
);
|
||||
|
||||
await driver.sendToDevice("org.example.foo", true, contentMap);
|
||||
expect(client.encryptAndSendToDevices.mock.calls).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("getTurnServers", () => {
|
||||
let driver: WidgetDriver;
|
||||
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`StopGapWidgetDriver sendToDevice sends encrypted messages 1`] = `
|
||||
[
|
||||
[
|
||||
[
|
||||
{
|
||||
"deviceInfo": DeviceInfo {
|
||||
"algorithms": [],
|
||||
"deviceId": "aliceWeb",
|
||||
"keys": {},
|
||||
"known": false,
|
||||
"signatures": {},
|
||||
"unsigned": {},
|
||||
"verified": 0,
|
||||
},
|
||||
"userId": "@alice:example.org",
|
||||
},
|
||||
{
|
||||
"deviceInfo": DeviceInfo {
|
||||
"algorithms": [],
|
||||
"deviceId": "aliceMobile",
|
||||
"keys": {},
|
||||
"known": false,
|
||||
"signatures": {},
|
||||
"unsigned": {},
|
||||
"verified": 0,
|
||||
},
|
||||
"userId": "@alice:example.org",
|
||||
},
|
||||
],
|
||||
{
|
||||
"hello": "alice",
|
||||
},
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
"deviceInfo": DeviceInfo {
|
||||
"algorithms": [],
|
||||
"deviceId": "bobDesktop",
|
||||
"keys": {},
|
||||
"known": false,
|
||||
"signatures": {},
|
||||
"unsigned": {},
|
||||
"verified": 0,
|
||||
},
|
||||
"userId": "@bob:example.org",
|
||||
},
|
||||
],
|
||||
{
|
||||
"hello": "bob",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`StopGapWidgetDriver sendToDevice sends unencrypted messages 1`] = `
|
||||
[
|
||||
[
|
||||
{
|
||||
"batch": [
|
||||
{
|
||||
"deviceId": "*",
|
||||
"payload": {
|
||||
"hello": "alice",
|
||||
},
|
||||
"userId": "@alice:example.org",
|
||||
},
|
||||
{
|
||||
"deviceId": "bobDesktop",
|
||||
"payload": {
|
||||
"hello": "bob",
|
||||
},
|
||||
"userId": "@bob:example.org",
|
||||
},
|
||||
],
|
||||
"eventType": "org.example.foo",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
Loading…
Add table
Add a link
Reference in a new issue