roles backend unit tests plus typos corrected on card and filer specs
This commit is contained in:
parent
426c747fec
commit
8dafd8c3b0
|
@ -2,7 +2,7 @@ import app from '../../../../server/server';
|
|||
import {catchErrors} from '../../../../../../services/utils/jasmineHelpers';
|
||||
|
||||
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 callback = (error, result) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import filter from '../filter';
|
||||
|
||||
describe('Greuge filterClients()', () => {
|
||||
describe('Client filterClients()', () => {
|
||||
it('should call the filterClients method', () => {
|
||||
let params = {
|
||||
page: 1,
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue