Skip to content

Commit

Permalink
added more tests to comply w kickoff - no docker tests still
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Feb 29, 2024
1 parent 7fcb95e commit ee781fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cmap/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export async function prepareHandshakeDocument(
const compressors = options.compressors ? options.compressors : [];
const { serverApi } = authContext.connection;
const clientMetadata = await addContainerMetadata(options.metadata);

const handshakeDoc: HandshakeDocument = {
[serverApi?.version || options.loadBalanced === true ? 'hello' : LEGACY_HELLO_COMMAND]: 1,
helloOk: true,
Expand Down
17 changes: 17 additions & 0 deletions test/unit/cmap/connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,23 @@ describe('Connect Tests', async function () {
const handshakeDocument = await prepareHandshakeDocument(authContext);
expect(handshakeDocument.client.env.container.orchestrator).to.equal('kubernetes');
});

it(`should not have 'name' property in client.env `, async () => {
const handshakeDocument = await prepareHandshakeDocument(authContext);
expect(handshakeDocument.client.env).to.not.have.property('name');
});
});
});

context('when container nor FAAS env is not present', async () => {
const authContext = {
connection: {},
options: { ...CONNECT_DEFAULTS }
};

it(`should not have 'env' property in client`, async () => {
const handshakeDocument = await prepareHandshakeDocument(authContext);
expect(handshakeDocument.client).to.not.have.property('env');
});
});

Expand Down

0 comments on commit ee781fc

Please sign in to comment.