-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
44 lines (37 loc) · 1.2 KB
/
app.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
39
40
41
42
43
44
const chai = require('chai');
const expect = chai.expect;
const chaiHttp = require('chai-http');
const sinon = require('sinon');
const sinonChai = require('sinon-chai');
chai.use(chaiHttp);
chai.use(sinonChai);
const foo = name => `Hi there, ${name}`;
describe('Object', function() {
it('should consider Object.is() to return false on positive and negative zero', function(done) {
expect(Object.is(0, -0)).to.equal(false);
done();
});
it('should consider tripple assignment operator to return true on positive and negative zero', function(done) {
expect(-0 === 0).to.equal(true);
done();
});
});
describe('Function', function() {
it('should return a greeting message with name passed as an argument', function(done) {
expect(foo('John')).to.equal('Hi there, John');
done();
});
});
describe('Fake JSON Placeholder', function() {
it('should return 200 and array of objects', function(done) {
chai
.request('https://jsonplaceholder.typicode.com')
.get('/users')
.end(function(err, res) {
expect(res).to.have.status(200);
expect(res.body).to.be.a('array');
expect(res.body[0].name).to.eql('Leanne Graham');
done();
});
});
});