2018-08-13 11:11:37 +00:00
|
|
|
const app = require(`${servicesDir}/client/server/server`);
|
2018-03-07 11:25:23 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|