Added the files.
This commit is contained in:
commit
38ccdcbfe5
124 changed files with 32079 additions and 0 deletions
38
server/test/examples.controller.js
Normal file
38
server/test/examples.controller.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
import chai from 'chai';
|
||||
import request from 'supertest';
|
||||
import Server from '../server';
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
describe('Examples', () => {
|
||||
it('should get all examples', () =>
|
||||
request(Server)
|
||||
.get('/api/v1/examples')
|
||||
.expect('Content-Type', /json/)
|
||||
.then((r) => {
|
||||
expect(r.body).to.be.an.an('array').of.length(2);
|
||||
}));
|
||||
|
||||
it('should add a new example', () =>
|
||||
request(Server)
|
||||
.post('/api/v1/examples')
|
||||
.send({ name: 'test' })
|
||||
.expect('Content-Type', /json/)
|
||||
.then((r) => {
|
||||
expect(r.body)
|
||||
.to.be.an.an('object')
|
||||
.that.has.property('name')
|
||||
.equal('test');
|
||||
}));
|
||||
|
||||
it('should get an example by id', () =>
|
||||
request(Server)
|
||||
.get('/api/v1/examples/2')
|
||||
.expect('Content-Type', /json/)
|
||||
.then((r) => {
|
||||
expect(r.body)
|
||||
.to.be.an.an('object')
|
||||
.that.has.property('name')
|
||||
.equal('test');
|
||||
}));
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue