Conditions | 1 |
Paths | 1 |
Total Lines | 42 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | "use strict"; |
||
15 | describe("test all routes", () => { |
||
16 | describe('/GET index', () => { |
||
17 | it('it should return object', (done) => { |
||
18 | chai.request(server) |
||
19 | .get('/') |
||
20 | .end((err, res) => { |
||
21 | res.should.have.status(200); |
||
22 | res.should.be.json; |
||
|
|||
23 | done(); |
||
24 | }); |
||
25 | }); |
||
26 | }); |
||
27 | |||
28 | describe('/GET post', () => { |
||
29 | it('it should return post information from Stackoverflow', (done) => { |
||
30 | chai.request(server) |
||
31 | .get('/posts/47810715') |
||
32 | .end((err, res) => { |
||
33 | res.should.have.status(200); |
||
34 | res.should.be.json; |
||
35 | let items = res.body.json.items; |
||
36 | |||
37 | items[0].title.should.equal("login template accepting every input"); |
||
38 | items[0].link.should.equal("https://stackoverflow.com/q/47810715"); |
||
39 | done(); |
||
40 | }); |
||
41 | }); |
||
42 | }); |
||
43 | |||
44 | describe('/GET Error', () => { |
||
45 | it('should return error', (done) => { |
||
46 | chai.request(server) |
||
47 | .get("/munge") |
||
48 | .end((err, res) => { |
||
49 | res.should.have.status(200); |
||
50 | res.header["content-type"].should.equal("application/json; charset=utf-8"); |
||
51 | res.body.should.be.a("object"); |
||
52 | done(); |
||
53 | }); |
||
54 | }); |
||
55 | }); |
||
56 | }); |
||
57 |