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-10-24 22:53:53 +00:00
|
|
|
beforeEach(ngModule('invoiceOut'));
|
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-10-24 22:53:53 +00:00
|
|
|
$httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for');
|
|
|
|
$httpBackend.expect('GET', `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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|