-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtest.js
More file actions
executable file
·36 lines (34 loc) · 1.01 KB
/
test.js
File metadata and controls
executable file
·36 lines (34 loc) · 1.01 KB
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
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.text.indexOf("new") !== -1);
expect(response).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;
response.should.have.property("name", "doobie");
done();
});
});
});