Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Apr 8, 2024
1 parent 227595b commit 6171b9f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ bundle:
deno bundle --log-level info --unstable src/mod.ts ./nats.js

fmt:
deno fmt src/ doc/ bin/ nats-base-client/ examples/ tests/ debug/ jetstream/ jetstream.md README.md services.md
deno fmt src/ doc/ bin/ nats-base-client/ examples/ tests/ debug/ unsafe_tests/ jetstream/ jetstream.md README.md services.md
62 changes: 31 additions & 31 deletions unsafe_tests/tlsunsafe_test.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import {resolve} from "https://deno.land/std@0.221.0/path/resolve.ts";
import {join} from "https://deno.land/std@0.221.0/path/join.ts";
import {NatsServer} from "../tests/helpers/launcher.ts";
import {connect} from "../src/connect.ts";
import { resolve } from "https://deno.land/std@0.221.0/path/resolve.ts";
import { join } from "https://deno.land/std@0.221.0/path/join.ts";
import { NatsServer } from "../tests/helpers/launcher.ts";
import { connect } from "../src/connect.ts";

Deno.test("tls-unsafe - handshake first", async () => {
const cwd = Deno.cwd();
const config = {
host: "localhost",
tls: {
handshake_first: true,
cert_file: resolve(join(cwd, "./tests/certs/localhost.crt")),
key_file: resolve(join(cwd, "./tests/certs/localhost.key")),
ca_file: resolve(join(cwd, "./tests/certs/RootCA.crt")),
},
};
const cwd = Deno.cwd();
const config = {
host: "localhost",
tls: {
handshake_first: true,
cert_file: resolve(join(cwd, "./tests/certs/localhost.crt")),
key_file: resolve(join(cwd, "./tests/certs/localhost.key")),
ca_file: resolve(join(cwd, "./tests/certs/RootCA.crt")),
},
};

const ns = await NatsServer.start(config);
const nc = await connect({
debug: true,
servers: `localhost:${ns.port}`,
tls: {
handshakeFirst: true,
caFile: config.tls.ca_file,
},
});
nc.subscribe("foo", {
callback(_err, msg) {
msg.respond(msg.data);
},
});
const ns = await NatsServer.start(config);
const nc = await connect({
debug: true,
servers: `localhost:${ns.port}`,
tls: {
handshakeFirst: true,
caFile: config.tls.ca_file,
},
});
nc.subscribe("foo", {
callback(_err, msg) {
msg.respond(msg.data);
},
});

await nc.request("foo", "hello");
await nc.close();
await ns.stop();
await nc.request("foo", "hello");
await nc.close();
await ns.stop();
});

0 comments on commit 6171b9f

Please sign in to comment.