Created
January 19, 2017 07:40
-
-
Save iworkforthem/f3772f552a13c7f2395d566df6cbb075 to your computer and use it in GitHub Desktop.
unit with mocha & chai.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.NODE_ENV = 'test'; | |
let chai = require('chai'); | |
let chaiHttp = require('chai-http'); | |
let server = require('../app'); | |
let should = chai.should(); | |
chai.use(chaiHttp); | |
describe('Server', () => { | |
describe('/GET ', () => { | |
it('it should load main page', (done) => { | |
chai.request(server) | |
.get('/') | |
.end((err, res) => { | |
res.should.have.status(200); | |
done(); | |
}); | |
}); | |
}); | |
describe('/GET ', () => { | |
it('it should load url /foo/bar', (done) => { | |
chai.request(server) | |
.get('/foo/bar') | |
.end((err, res) => { | |
res.should.have.status(404); | |
done(); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment