Skip to content

Commit 026b91a

Browse files
committed
add removed test
1 parent 4cf78c2 commit 026b91a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/unit/common/session.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,17 @@ describe("Session", () => {
8888
// Should include the client name in the appName
8989
expect(connectionString).toContain("--test-device-id--test-client");
9090
});
91+
92+
it("should use 'unknown' for client name when agent runner is not set", async () => {
93+
await session.connectToMongoDB("mongodb://localhost:27017", config.connectOptions);
94+
expect(session.serviceProvider).toBeDefined();
95+
96+
const connectMock = MockNodeDriverServiceProvider.connect;
97+
expect(connectMock).toHaveBeenCalledOnce();
98+
const connectionString = connectMock.mock.calls[0]?.[0];
99+
100+
// Should use 'unknown' for client name when agent runner is not set
101+
expect(connectionString).toContain("--test-device-id--unknown");
102+
});
91103
});
92104
});

0 commit comments

Comments
 (0)