Skip to content

Commit

Permalink
fix DeviceListenerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Aug 15, 2023
1 parent e56040e commit e1c1eb9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/DeviceListener-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ describe("DeviceListener", () => {
let mockClient: Mocked<MatrixClient>;
let mockCrypto: Mocked<CryptoApi>;

// spy on various toasts' hide and show functions
// easier than mocking
jest.spyOn(SetupEncryptionToast, "showToast");
jest.spyOn(SetupEncryptionToast, "hideToast");
jest.spyOn(BulkUnverifiedSessionsToast, "showToast");
jest.spyOn(BulkUnverifiedSessionsToast, "hideToast");
jest.spyOn(UnverifiedSessionToast, "showToast");
jest.spyOn(UnverifiedSessionToast, "hideToast");

beforeEach(() => {
jest.resetAllMocks();

// spy on various toasts' hide and show functions
// easier than mocking
jest.spyOn(SetupEncryptionToast, "showToast").mockReturnValue(undefined);
jest.spyOn(SetupEncryptionToast, "hideToast").mockReturnValue(undefined);
jest.spyOn(BulkUnverifiedSessionsToast, "showToast").mockReturnValue(undefined);
jest.spyOn(BulkUnverifiedSessionsToast, "hideToast").mockReturnValue(undefined);
jest.spyOn(UnverifiedSessionToast, "showToast").mockResolvedValue(undefined);
jest.spyOn(UnverifiedSessionToast, "hideToast").mockReturnValue(undefined);

mockPlatformPeg({
getAppVersion: jest.fn().mockResolvedValue("1.2.3"),
});
Expand Down

0 comments on commit e1c1eb9

Please sign in to comment.