salix/services/loopback/common/methods/client/specs/isValidClient.spec.js

58 lines
1.8 KiB
JavaScript

const app = require(`${servicesDir}/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();
});
});
});