Skip to content

Commit 3ebda61

Browse files
Fix prettier
1 parent 6c41687 commit 3ebda61

1 file changed

Lines changed: 34 additions & 30 deletions

File tree

nodejs/test/e2e/commands.test.ts

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,41 @@ describe("Commands", async () => {
2323
await client2.stop();
2424
});
2525

26-
it("client receives commands.changed when another client joins with commands", { timeout: 20_000 }, async () => {
27-
const session1 = await client1.createSession({
28-
onPermissionRequest: approveAll,
29-
});
26+
it(
27+
"client receives commands.changed when another client joins with commands",
28+
{ timeout: 20_000 },
29+
async () => {
30+
const session1 = await client1.createSession({
31+
onPermissionRequest: approveAll,
32+
});
3033

31-
type CommandsChangedEvent = Extract<SessionEvent, { type: "commands.changed" }>;
34+
type CommandsChangedEvent = Extract<SessionEvent, { type: "commands.changed" }>;
3235

33-
// Wait for the commands.changed event deterministically
34-
const commandsChangedPromise = new Promise<CommandsChangedEvent>((resolve) => {
35-
session1.on((event) => {
36-
if (event.type === "commands.changed") resolve(event);
36+
// Wait for the commands.changed event deterministically
37+
const commandsChangedPromise = new Promise<CommandsChangedEvent>((resolve) => {
38+
session1.on((event) => {
39+
if (event.type === "commands.changed") resolve(event);
40+
});
3741
});
38-
});
39-
40-
// Client2 joins with commands
41-
const session2 = await client2.resumeSession(session1.sessionId, {
42-
onPermissionRequest: approveAll,
43-
commands: [
44-
{ name: "deploy", description: "Deploy the app", handler: async () => {} },
45-
],
46-
disableResume: true,
47-
});
48-
49-
// Rely on default vitest timeout
50-
const commandsChanged = await commandsChangedPromise;
51-
expect(commandsChanged.data.commands).toEqual(
52-
expect.arrayContaining([
53-
expect.objectContaining({ name: "deploy", description: "Deploy the app" }),
54-
]),
55-
);
56-
57-
await session2.disconnect();
58-
});
42+
43+
// Client2 joins with commands
44+
const session2 = await client2.resumeSession(session1.sessionId, {
45+
onPermissionRequest: approveAll,
46+
commands: [
47+
{ name: "deploy", description: "Deploy the app", handler: async () => {} },
48+
],
49+
disableResume: true,
50+
});
51+
52+
// Rely on default vitest timeout
53+
const commandsChanged = await commandsChangedPromise;
54+
expect(commandsChanged.data.commands).toEqual(
55+
expect.arrayContaining([
56+
expect.objectContaining({ name: "deploy", description: "Deploy the app" }),
57+
])
58+
);
59+
60+
await session2.disconnect();
61+
}
62+
);
5963
});

0 commit comments

Comments
 (0)