61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
const app = require('../../../../../client/server/server');
|
|
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
|
|
|
describe('Client hasCustomerRole', () => {
|
|
it('should call the hasCustomerRole() method with a customer id', done => {
|
|
let id = 101;
|
|
let params = {};
|
|
|
|
let callback = (error, result) => {
|
|
if (error) return catchErrors(done)(error);
|
|
|
|
expect(result).toEqual(jasmine.objectContaining({isCustomer: 1}));
|
|
done();
|
|
};
|
|
|
|
app.models.Client.hasCustomerRole(id, params, callback);
|
|
});
|
|
|
|
it('should call the hasCustomerRole() 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.hasCustomerRole(id, params, callback);
|
|
});
|
|
|
|
it('should call the hasCustomerRole() 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.hasCustomerRole(id, params, callback);
|
|
});
|
|
|
|
it('should call the hasCustomerRole() 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.hasCustomerRole(id, params, callback);
|
|
});
|
|
});
|