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

31 lines
1.1 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;
2020-03-17 13:43:46 +00:00
let $scope;
2019-03-28 10:55:23 +00:00
beforeEach(ngModule('invoiceOut'));
2019-03-28 10:55:23 +00:00
2020-03-17 13:43:46 +00:00
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
2019-03-28 10:55:23 +00:00
$httpBackend = _$httpBackend_;
2020-03-17 13:43:46 +00:00
$scope = $rootScope.$new();
const $element = angular.element('<vn-invoice-out-summary></vn-invoice-out-summary>');
controller = $componentController('vnInvoiceOutSummary', {$element, $scope});
2019-04-17 09:44:00 +00:00
controller.invoiceOut = {id: 1};
2019-03-28 10:55:23 +00:00
}));
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
$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
});
});
});
});