1
0
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:
Michael Weimann
2022-12-09 09:38:20 +01:00
parent 08a9073bd5
commit 349c2c2587
239 changed files with 22004 additions and 21928 deletions

View File

@ -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");
});
});
});