Skip to content

Commit 25a9f82

Browse files
committed
Lint
1 parent dde5fb7 commit 25a9f82

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

spec/unit/embedded.spec.ts

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,15 @@ class MockWidgetApi extends EventEmitter {
6060
public requestCapabilityToSendToDevice = jest.fn();
6161
public requestCapabilityToReceiveToDevice = jest.fn();
6262
public sendRoomEvent = jest.fn(
63-
(
64-
eventType: string,
65-
content: unknown,
66-
roomId?: string,
67-
futureTimeout?: number,
68-
futureGroupId?: string
69-
) =>
63+
(eventType: string, content: unknown, roomId?: string, futureTimeout?: number, futureGroupId?: string) =>
7064
futureTimeout === undefined && futureGroupId === undefined
7165
? { event_id: `$${Math.random()}` }
7266
: {
7367
future_group_id: futureGroupId ?? `fg-${Math.random()}`,
7468
send_token: `st-${Math.random()}`,
7569
cancel_token: `ct-${Math.random()}`,
7670
refresh_token: `rt-${Math.random()}`,
77-
}
71+
},
7872
);
7973
public sendStateEvent = jest.fn(
8074
(
@@ -92,7 +86,7 @@ class MockWidgetApi extends EventEmitter {
9286
send_token: `st-${Math.random()}`,
9387
cancel_token: `ct-${Math.random()}`,
9488
refresh_token: `rt-${Math.random()}`,
95-
}
89+
},
9690
);
9791
public sendToDevice = jest.fn();
9892
public requestOpenIDConnectToken = jest.fn(() => {
@@ -196,7 +190,7 @@ describe("RoomWidgetClient", () => {
196190
describe("futures", () => {
197191
describe("when supported", () => {
198192
const doesServerSupportUnstableFeatureMock = jest.fn((feature) =>
199-
Promise.resolve(feature === "org.matrix.msc4140")
193+
Promise.resolve(feature === "org.matrix.msc4140"),
200194
);
201195

202196
beforeAll(() => {
@@ -300,7 +294,7 @@ describe("RoomWidgetClient", () => {
300294
};
301295

302296
for (const missingField of Object.keys(response)) {
303-
const badResponse: Record<string, string> = {...response};
297+
const badResponse: Record<string, string> = { ...response };
304298
delete badResponse[missingField];
305299
const fullBadResponse = { ...badResponse, room_id: "!1:example.org" };
306300

@@ -314,7 +308,7 @@ describe("RoomWidgetClient", () => {
314308
null,
315309
"org.matrix.rageshake_request",
316310
{ request_id: 123 },
317-
)
311+
),
318312
).rejects.toThrow(`'${missingField}' absent from response`);
319313
});
320314

@@ -323,12 +317,12 @@ describe("RoomWidgetClient", () => {
323317
await makeClient({ sendState: [{ eventType: "org.example.foo", stateKey: "bar" }] });
324318
await expect(
325319
client._unstable_sendStateFuture(
326-
"!1:example.org",
327-
{ future_timeout: 2000, },
328-
"org.example.foo",
329-
{ hello: "world" },
330-
"bar",
331-
)
320+
"!1:example.org",
321+
{ future_timeout: 2000 },
322+
"org.example.foo",
323+
{ hello: "world" },
324+
"bar",
325+
),
332326
).rejects.toThrow(`'${missingField}' absent from response`);
333327
});
334328
}
@@ -345,20 +339,20 @@ describe("RoomWidgetClient", () => {
345339
null,
346340
"org.matrix.rageshake_request",
347341
{ request_id: 123 },
348-
)
342+
),
349343
).rejects.toThrow("Server does not support the Futures API");
350344
});
351345

352346
it("fails to send state futures", async () => {
353347
await makeClient({ sendState: [{ eventType: "org.example.foo", stateKey: "bar" }] });
354348
await expect(
355349
client._unstable_sendStateFuture(
356-
"!1:example.org",
357-
{ future_timeout: 2000, },
358-
"org.example.foo",
359-
{ hello: "world" },
360-
"bar",
361-
)
350+
"!1:example.org",
351+
{ future_timeout: 2000 },
352+
"org.example.foo",
353+
{ hello: "world" },
354+
"bar",
355+
),
362356
).rejects.toThrow("Server does not support the Futures API");
363357
});
364358
});

src/embedded.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ export class RoomWidgetClient extends MatrixClient {
299299
content: any,
300300
stateKey = "",
301301
): Promise<ISendEventResponse> {
302-
return this.validateSendEventResponse(await this.widgetApi.sendStateEvent(eventType, stateKey, content, roomId));
302+
return this.validateSendEventResponse(
303+
await this.widgetApi.sendStateEvent(eventType, stateKey, content, roomId),
304+
);
303305
}
304306

305307
/**
@@ -313,6 +315,7 @@ export class RoomWidgetClient extends MatrixClient {
313315
content: StateEvents[K],
314316
stateKey: string,
315317
): Promise<SendFutureResponse<F>>;
318+
// eslint-disable-next-line
316319
public async _unstable_sendStateFuture<K extends keyof StateEvents>(
317320
roomId: string,
318321
futureOpts: SendFutureRequestOpts,
@@ -359,7 +362,7 @@ export class RoomWidgetClient extends MatrixClient {
359362
future_group_id: response.future_group_id,
360363
cancel_token: response.cancel_token,
361364
send_token: response.send_token,
362-
}
365+
};
363366
}
364367

365368
private validateSendTimeoutFutureResponse(response: ISendEventFromWidgetResponseData): SendTimeoutFutureResponse {

0 commit comments

Comments
 (0)