roles backend unit tests plus typos corrected on card and filer specs

This commit is contained in:
Carlos Jimenez 2018-01-26 09:00:16 +01:00
parent 426c747fec
commit 8dafd8c3b0
3 changed files with 62 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import app from '../../../../server/server';
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers'; import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
describe('Client card', () => { describe('Client card', () => {
it('should call the card() method to receive a formatd card of Bruce Wayne', done => { it('should call the card() method to receive a formated card of Bruce Wayne', done => {
let id = 1; let id = 1;
let callback = (error, result) => { let callback = (error, result) => {

View File

@ -1,6 +1,6 @@
import filter from '../filter'; import filter from '../filter';
describe('Greuge filterClients()', () => { describe('Client filterClients()', () => {
it('should call the filterClients method', () => { it('should call the filterClients method', () => {
let params = { let params = {
page: 1, page: 1,

View File

@ -0,0 +1,60 @@
import app from '../../../../server/server';
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
describe('Client getRoleCustomer', () => {
it('should call the getRoleCustomer() method with a customer id', done => {
let id = 1;
let params = {};
let callback = (error, result) => {
if (error) return catchErrors(done)(error);
expect(result).toEqual(jasmine.objectContaining({isCustomer: 1}));
done();
};
app.models.Client.getRoleCustomer(id, params, callback);
});
it('should call the getRoleCustomer() method with a non customer id', done => {
let id = 8;
let params = {};
let callback = (error, result) => {
if (error) return catchErrors(done)(error);
expect(result).toEqual(jasmine.objectContaining({isCustomer: 0}));
done();
};
app.models.Client.getRoleCustomer(id, params, callback);
});
it('should call the getRoleCustomer() method with an unreal id', done => {
let id = 999;
let params = {};
let callback = (error, result) => {
if (error) return catchErrors(done)(error);
expect(result).toEqual(jasmine.objectContaining({isCustomer: 0}));
done();
};
app.models.Client.getRoleCustomer(id, params, callback);
});
it('should call the getRoleCustomer() method with an invalid id', done => {
let id = 'WRONG!';
let params = {};
let callback = (error, result) => {
if (error) return catchErrors(done)(error);
expect(result).toEqual(jasmine.objectContaining({isCustomer: 0}));
done();
};
app.models.Client.getRoleCustomer(id, params, callback);
});
});