Skip to content

Commit d0790b5

Browse files
committed
chore: Rename to connect for consistency
1 parent e50d706 commit d0790b5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/common/session.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface SessionOptions {
1414
}
1515

1616
export type SessionEvents = {
17-
connected: [];
17+
connect: [];
1818
close: [];
1919
disconnect: [];
2020
"connection-error": [string];
@@ -130,6 +130,6 @@ export class Session extends EventEmitter<SessionEvents> {
130130
throw error;
131131
}
132132

133-
this.emit("connected");
133+
this.emit("connect");
134134
}
135135
}

src/resources/common/debug.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export class DebugResource extends ReactiveResource(
1818
},
1919
{
2020
initial: { tag: "disconnected" } as ConnectionStateDebuggingInformation,
21-
events: ["connected", "disconnect", "close", "connection-error"],
21+
events: ["connect", "disconnect", "close", "connection-error"],
2222
}
2323
) {
2424
reduce(
25-
eventName: "connected" | "disconnect" | "close" | "connection-error",
25+
eventName: "connect" | "disconnect" | "close" | "connection-error",
2626
event: string | undefined
2727
): ConnectionStateDebuggingInformation {
2828
void event;
2929

3030
switch (eventName) {
31-
case "connected":
31+
case "connect":
3232
return { tag: "connected" };
3333
case "connection-error":
3434
return { tag: "errored", errorReason: event };

tests/unit/resources/common/debug.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("debug resource", () => {
1919
});
2020

2121
it("should be connected when a connected event happens", () => {
22-
debugResource.reduceApply("connected", undefined);
22+
debugResource.reduceApply("connect", undefined);
2323
const output = debugResource.toOutput();
2424

2525
expect(output).toContain(`The user is connected to the MongoDB cluster.`);

0 commit comments

Comments
 (0)