Skip to content
Snippets Groups Projects
Unverified Commit 74f9504f authored by Fazal's avatar Fazal Committed by GitHub
Browse files

Add files via upload

parent 02416de0
No related branches found
No related tags found
No related merge requests found
const request = require('supertest');
const knex = require('../db/knex');
const expect = require('chai').expect;
const app = require('../app');
const fixtures = require('./fixtures');
describe('CRUD employee', () => {
Before(() => {
// run migation
knex.migrate.latest()
.then(() => {
//run seeds
return knex.seed.run();
}).then(() => done());
});
it('List all Records', (done) => {
request(app)
.get('api/employee')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.then((response) => {
expect(response.body).to.be.a('array');
expect(response.body).to.deep.equal(fixtures.employee);
done();
});
});
it('Lists a Record by id', (done) => {
request(app)
.get('api/employee/1')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.then((response) => {
expect(response.body).to.be.a('object');
expect(response.body).to.deep.equal(fixtures.employee);
done();
});
it('creates a record', (done) => {
request(app)
.post('/api/employee')
.send(fixtures.employee)
.set('accept', 'application/json')
.expect('Content-Type', '/json/')
.expect(200)
.then((response) => {
expect(response.body).to.be.a('object');
fixtures.employee.id = response.body.id;
expect(response.body).to.deep.equal(fixtures.employee);
done();
});
});
});
});
\ No newline at end of file
const employee =[ {
id: 1,
name:'fazal' ,
mobile:'9789898908',
email:'fazalurrahman2005@gmail.com',
designation:'intern',
role:'web dev',
type:'admin',
date_of_joining:'10-12-2021',
date_of_birth:'19-03-2005',
address:'No.5 medavakkam main road,xxxx'
}]
module.exports = {
employee
}
\ No newline at end of file
server/users-db.jpeg

13 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment