You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-30 04:23:07 +03:00
Apply prettier formatting
This commit is contained in:
@ -19,8 +19,8 @@ import { emitPromise } from "../../test-utils/test-utils";
|
||||
import { EventType } from "../../../src";
|
||||
import { Crypto } from "../../../src/crypto";
|
||||
|
||||
describe('MatrixEvent', () => {
|
||||
it('should create copies of itself', () => {
|
||||
describe("MatrixEvent", () => {
|
||||
it("should create copies of itself", () => {
|
||||
const a = new MatrixEvent({
|
||||
type: "com.example.test",
|
||||
content: {
|
||||
@ -38,7 +38,7 @@ describe('MatrixEvent', () => {
|
||||
// The other properties we're not super interested in, honestly.
|
||||
});
|
||||
|
||||
it('should compare itself to other events using json', () => {
|
||||
it("should compare itself to other events using json", () => {
|
||||
const a = new MatrixEvent({
|
||||
type: "com.example.test",
|
||||
content: {
|
||||
@ -122,36 +122,37 @@ describe('MatrixEvent', () => {
|
||||
|
||||
describe(".attemptDecryption", () => {
|
||||
let encryptedEvent: MatrixEvent;
|
||||
const eventId = 'test_encrypted_event';
|
||||
const eventId = "test_encrypted_event";
|
||||
|
||||
beforeEach(() => {
|
||||
encryptedEvent = new MatrixEvent({
|
||||
event_id: eventId,
|
||||
type: 'm.room.encrypted',
|
||||
type: "m.room.encrypted",
|
||||
content: {
|
||||
ciphertext: 'secrets',
|
||||
ciphertext: "secrets",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should retry decryption if a retry is queued', async () => {
|
||||
const eventAttemptDecryptionSpy = jest.spyOn(encryptedEvent, 'attemptDecryption');
|
||||
it("should retry decryption if a retry is queued", async () => {
|
||||
const eventAttemptDecryptionSpy = jest.spyOn(encryptedEvent, "attemptDecryption");
|
||||
|
||||
const crypto = {
|
||||
decryptEvent: jest.fn()
|
||||
decryptEvent: jest
|
||||
.fn()
|
||||
.mockImplementationOnce(() => {
|
||||
// schedule a second decryption attempt while
|
||||
// the first one is still running.
|
||||
encryptedEvent.attemptDecryption(crypto);
|
||||
|
||||
const error = new Error("nope");
|
||||
error.name = 'DecryptionError';
|
||||
error.name = "DecryptionError";
|
||||
return Promise.reject(error);
|
||||
})
|
||||
.mockImplementationOnce(() => {
|
||||
return Promise.resolve({
|
||||
clearEvent: {
|
||||
type: 'm.room.message',
|
||||
type: "m.room.message",
|
||||
},
|
||||
});
|
||||
}),
|
||||
@ -161,7 +162,7 @@ describe('MatrixEvent', () => {
|
||||
|
||||
expect(eventAttemptDecryptionSpy).toHaveBeenCalledTimes(2);
|
||||
expect(crypto.decryptEvent).toHaveBeenCalledTimes(2);
|
||||
expect(encryptedEvent.getType()).toEqual('m.room.message');
|
||||
expect(encryptedEvent.getType()).toEqual("m.room.message");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user