2018-08-14 09:52:10 +00:00
|
|
|
const app = require(`${servicesDir}/order/server/server`);
|
2018-08-07 14:04:42 +00:00
|
|
|
|
2018-09-21 13:01:51 +00:00
|
|
|
describe('order getTaxes()', () => {
|
2018-08-07 14:04:42 +00:00
|
|
|
it('should call the getTaxes method and return undefined if its called with a string', async() => {
|
|
|
|
let result = await app.models.Order.getTaxes('pepinillos');
|
|
|
|
|
2018-10-08 13:21:06 +00:00
|
|
|
expect(result.length).toEqual(0);
|
2018-08-07 14:04:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should call the getTaxes method and return undefined if its called with unknown id', async() => {
|
|
|
|
let result = await app.models.Order.getTaxes(99999999999999999999999);
|
|
|
|
|
2018-10-08 13:21:06 +00:00
|
|
|
expect(result.length).toEqual(0);
|
2018-08-07 14:04:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should call the getTaxes method and return the taxes if its called with a known id', async() => {
|
|
|
|
let result = await app.models.Order.getTaxes(1);
|
|
|
|
|
2018-10-10 10:55:04 +00:00
|
|
|
expect(result[0].tax).toEqual(9.49);
|
2018-10-08 13:21:06 +00:00
|
|
|
expect(result.length).toEqual(1);
|
2018-08-07 14:04:42 +00:00
|
|
|
});
|
|
|
|
});
|