Skip to content

Commit

Permalink
2.1 get root
Browse files Browse the repository at this point in the history
  • Loading branch information
ShMcK committed Mar 17, 2020
1 parent 79d3c1c commit b08cb17
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -21,6 +21,7 @@
"devDependencies": {
"mocha": "^7.0.1",
"mocha-tap-reporter": "^0.1.3",
"sinon": "^9.0.1"
"sinon": "^9.0.1",
"supertest": "^4.0.2"
}
}
19 changes: 12 additions & 7 deletions test/server.test.js
@@ -1,13 +1,18 @@
const assert = require("assert");
const sinon = require("sinon");
const request = require("supertest");
const server = require("../src/server");

describe("server", () => {
// 1.2
it('should log "Hello World"', () => {
const spy = sinon.spy(console, "log");
const server = require("../src/server");
const result = spy.calledWith("Hello World");
assert.ok(result);
// 2.1
it('should return "Hello Express" when GET "/" is called', () => {
return request(server)
.get("/")
.expect(200)
.then(response => {
assert.equal(response.text, "Hello Express");
});
});
after(() => {
server.close();
});
});

0 comments on commit b08cb17

Please sign in to comment.