From ee781fc153596d1d617e8c83b5b63e2f00b7be2f Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Thu, 29 Feb 2024 14:26:26 -0500 Subject: [PATCH] added more tests to comply w kickoff - no docker tests still --- src/cmap/connect.ts | 1 + test/unit/cmap/connect.test.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/cmap/connect.ts b/src/cmap/connect.ts index cbf66c843ac..1d49a0c2287 100644 --- a/src/cmap/connect.ts +++ b/src/cmap/connect.ts @@ -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, diff --git a/test/unit/cmap/connect.test.ts b/test/unit/cmap/connect.test.ts index a32bf2a187f..72b41d47adb 100644 --- a/test/unit/cmap/connect.test.ts +++ b/test/unit/cmap/connect.test.ts @@ -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'); }); });