Skip to content

Commit

Permalink
bind for singular ports works properly
Browse files Browse the repository at this point in the history
  • Loading branch information
iangeckeler committed Aug 13, 2019
1 parent e153660 commit 4a0e7e1
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions __tests__/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,39 @@ describe("Unit tests for bind.", () => {
it("Bind should support a single port insecurely if no config supplied.", () => {
const server = new Server();
const boundPorts = server.bind("0.0.0.0:3000");
expect(boundPorts[0]).toBeGreaterThanOrEqual(0);
expect(boundPorts.length).toBe(1);
});

it("If one cert is passed, it is applied to all of the different ports.", () => {});
it("If no cert/key is passed with an array of ports, they are all generated but insecure.", () => {
const server = new Server();
const boundPorts = server.bind(["0.0.0.0:3000", "0.0.0.0:3001"]);
expect(boundPorts.length).toBe(2);
});

it("Properly binds one SSL", () => {
const server = new Server();
let certPath = path.join(__dirname, "/test1.crt");
let keyPath = path.join(__dirname, "/test1.key");
const boundPorts = server.bind("0.0.0.0:3000", {
privateKey: keyPath,
certificate: certPath
});
expect(boundPorts.length).toBe(1);
});

xit("If array of ports and certs/keys are passed each port at index in ports array is bound matching the cert at the same index of the certs array", () => {});

it("If no cert is passed with an array of ports, they are all generated but insecure.", () => {});
xit("If one cert/key pair is passed, it is applied to all of the different ports.", () => {
const server = new Server();
let certPath = path.join(__dirname, "/test1.crt");
let keyPath = path.join(__dirname, "/test1.key");
const boundPorts = server.bind("0.0.0.0:3000", {
privateKey: keyPath,
certificate: certPath
});
console.log(boundPorts);
expect(boundPorts[0]).toBeGreaterThan(0);
});
});

xdescribe("Uncaught Error Handling.", () => {
Expand Down

0 comments on commit 4a0e7e1

Please sign in to comment.