Skip to content

Commit

Permalink
added test to verify that Connect is not leaking tls options (#71)
Browse files Browse the repository at this point in the history
* added test to verify that tls optiosn are not leaked
* bumped version
  • Loading branch information
aricart authored Sep 29, 2020
1 parent 7f07af3 commit e7c566e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/deno_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from "../nats-base-client/internal_mod.ts";
import type { TlsOptions } from "../nats-base-client/types.ts";

const VERSION = "1.0.0-8";
const VERSION = "1.0.0-9";
const LANG = "nats.deno";

// if trying to simply write to the connection for some reason
Expand Down
24 changes: 24 additions & 0 deletions tests/properties_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,27 @@ Deno.test("properties - configured user/pass options", async () => {
assertEquals(cc.pass, opts.pass);
assertEquals(cc.auth_token, undefined);
});

Deno.test("properties - tls doesn't leak options", () => {
const tlsOptions = {
keyFile: "keyFile",
certFile: "certFile",
caFile: "caFile",
key: "key",
cert: "cert",
ca: "ca",
};

let opts = { tls: tlsOptions, cert: "another" };
const auth = buildAuthenticator(opts);
opts = extend(opts, auth);

const c = new Connect({ version: "1.2.3", lang: "test" }, opts);
const cc = JSON.parse(JSON.stringify(c));
assertEquals(cc.tls_required, true);
assertEquals(cc.cert, undefined);
assertEquals(cc.keyFile, undefined);
assertEquals(cc.certFile, undefined);
assertEquals(cc.caFile, undefined);
assertEquals(cc.tls, undefined);
});

0 comments on commit e7c566e

Please sign in to comment.