wages-ws
Version:
This server read data from a cassandra DB and provide services for MyWagesApp
116 lines (103 loc) • 4.03 kB
JavaScript
var assert = require('chai').assert;
var expect = require('chai').expect;
var supertest = require('supertest');
var api = supertest('http://10.226.113.107:8080');
describe('WOSH Service', function(){
it('should return a 200 ok status code', function(done){
api.get('/WOSH_service/id/144/text/Pharmacy')
.set('Accept', 'application/json')
.expect(200,done);
});
it('should get an json object with id, hours, role, and text', function(done){
api.get('/WOSH_service/id/114/text/Meat')
.set('Accept', 'application/json')
.expect(200)
.end(function(err, res){
expect(res.body[0]).to.have.property("id");
expect(res.body.id).to.not.equal(null);
expect(res.body[0]).to.have.property("hours");
expect(res.body.hours).to.not.equal(null);
expect(res.body[0]).to.have.property("role");
expect(res.body.role).to.not.equal(null);
expect(res.body[0]).to.have.property("text");
expect(res.body.text).to.not.equal(null);
done();
});
});
it('should get the row info', function(done){
api.get('/WOSH_service/id/114/text/Meat')
.set('Accept', 'application/json')
.expect(200,[{
id:114,
hours:40736.5,
role:'Meat SA',
text:'Meat'
}] , done);
});
});
describe('Punch Data Service', function(){
it('should return a 200 ok status code', function(done){
api.get('/WOSH_service/id/144/text/Pharmacy')
.set('Accept', 'application/json')
.expect(200,done);
});
it('should get an json object with id, hours, role, and text', function(done){
api.get('/WOSH_service/id/114/text/Meat')
.set('Accept', 'application/json')
.expect(200)
.end(function(err, res){
expect(res.body[0]).to.have.property("id");
expect(res.body.id).to.not.equal(null);
expect(res.body[0]).to.have.property("hours");
expect(res.body.hours).to.not.equal(null);
expect(res.body[0]).to.have.property("role");
expect(res.body.role).to.not.equal(null);
expect(res.body[0]).to.have.property("text");
expect(res.body.text).to.not.equal(null);
done();
});
});
it('should get the row info', function(done){
api.get('/WOSH_service/id/114/text/Meat')
.set('Accept', 'application/json')
.expect(200,[{
id:114,
hours:40736.5,
role:'Meat SA',
text:'Meat'
}] , done);
});
});
describe('Overtime Service', function(){
it('should return a 200 ok status code', function(done){
api.get('/WOSH_service/id/144/text/Pharmacy')
.set('Accept', 'application/json')
.expect(200,done);
});
it('should get an json object with id, hours, role, and text', function(done){
api.get('/WOSH_service/id/114/text/Meat')
.set('Accept', 'application/json')
.expect(200)
.end(function(err, res){
expect(res.body[0]).to.have.property("id");
expect(res.body.id).to.not.equal(null);
expect(res.body[0]).to.have.property("hours");
expect(res.body.hours).to.not.equal(null);
expect(res.body[0]).to.have.property("role");
expect(res.body.role).to.not.equal(null);
expect(res.body[0]).to.have.property("text");
expect(res.body.text).to.not.equal(null);
done();
});
});
it('should get the row info', function(done){
api.get('/WOSH_service/id/114/text/Meat')
.set('Accept', 'application/json')
.expect(200,[{
id:114,
hours:40736.5,
role:'Meat SA',
text:'Meat'
}] , done);
});
});