salix/modules/invoiceOut/front/summary/index.spec.js

30 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-03-28 10:55:23 +00:00
import './index.js';
2019-04-17 09:44:00 +00:00
describe('InvoiceOut', () => {
2019-03-28 10:55:23 +00:00
describe('Component summary', () => {
let controller;
let $httpBackend;
2019-09-13 14:09:14 +00:00
beforeEach(angular.mock.module('invoiceOut', $translateProvider => {
$translateProvider.translations('en', {});
}));
2019-03-28 10:55:23 +00:00
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
2019-04-17 09:44:00 +00:00
controller = $componentController('vnInvoiceOutSummary');
controller.invoiceOut = {id: 1};
2019-03-28 10:55:23 +00:00
}));
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
2019-04-17 09:44:00 +00:00
$httpBackend.when('GET', `/api/InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
$httpBackend.expect('GET', `/api/InvoiceOuts/1/summary`);
2019-03-28 10:55:23 +00:00
controller.getSummary();
$httpBackend.flush();
2019-04-17 09:44:00 +00:00
expect(controller.summary).toEqual('the data you are looking for');
2019-03-28 10:55:23 +00:00
});
});
});
});