#155 back end unit tests for webaccess new functionality

This commit is contained in:
Carlos Jimenez 2018-03-07 12:25:23 +01:00
parent 60e4ca132a
commit a95f2c3ada
1 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,57 @@
const app = require('../../../../../client/server/server');
describe('Client isValidClient', () => {
it('should call the isValidClient() method with a client id and receive true', done => {
let id = 101;
app.models.Client.isValidClient(id)
.then(result => {
expect(result).toBeTruthy();
done();
});
});
it('should call the isValidClient() method with a employee id and receive false', done => {
let id = 1;
app.models.Client.isValidClient(id)
.then(result => {
expect(result).toBeFalsy();
done();
});
});
it('should call the isValidClient() method with a unexistant id and receive false', done => {
let id = 999999;
app.models.Client.isValidClient(id)
.then(result => {
expect(result).toBeFalsy();
done();
});
});
it('should call the isValidClient() method with a invalid id and receive false', done => {
let id = 'Pepinillos';
app.models.Client.isValidClient(id)
.then(result => {
expect(result).toBeFalsy();
done();
});
});
it('should call the isValidClient() method with a customer id which isnt active and return false', done => {
let id = '106';
app.models.Client.isValidClient(id)
.then(result => {
expect(result).toBeFalsy();
done();
});
});
it('should call the isValidClient() method with a customer id which his data isnt verified and return false', done => {
let id = '110';
app.models.Client.isValidClient(id)
.then(result => {
expect(result).toBeFalsy();
done();
});
});
});