-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
38 lines (36 loc) · 1.08 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var superagent = require("superagent"),
chai = require("chai"),
expect = chai.expect,
should = require("should");
describe("Index", function () {
it("renders HTML", function (done) {
superagent.get("http://localhost:3000/")
.end(function (e, res) {
(e === null).should.equal(true);
res.text.should.equal("Hey buddy!");
done();
});
});
});
describe("Persistence", function () {
it("should create a thing", function (done) {
superagent.get("http://localhost:3000/doobie")
.end(function (e, res) {
(e === null).should.equal(true);
var response = res.body;
expect(response.created).to.equal(true);
done();
});
});
it("should retrieve a thing", function (done) {
superagent.get("http://localhost:3000/doobie")
.end(function (e, res) {
(e === null).should.equal(true);
var response = res.body;
expect(response.created).to.equal(false);
response = response.returnObj;
response.should.have.property("name", "doobie");
done();
});
});
});