Added the files.

This commit is contained in:
Batuhan Berk Başoğlu 2021-03-30 21:50:36 -04:00
commit 38ccdcbfe5
124 changed files with 32079 additions and 0 deletions

View 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');
}));
});