31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import './index.js';
|
|
|
|
describe('InvoiceOut', () => {
|
|
describe('Component summary', () => {
|
|
let controller;
|
|
let $httpBackend;
|
|
let $scope;
|
|
|
|
beforeEach(ngModule('invoiceOut'));
|
|
|
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => {
|
|
$httpBackend = _$httpBackend_;
|
|
$scope = $rootScope.$new();
|
|
const $element = angular.element('<vn-invoice-out-summary></vn-invoice-out-summary>');
|
|
controller = $componentController('vnInvoiceOutSummary', {$element, $scope});
|
|
controller.invoiceOut = {id: 1};
|
|
}));
|
|
|
|
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`);
|
|
controller.getSummary();
|
|
$httpBackend.flush();
|
|
|
|
expect(controller.summary).toEqual('the data you are looking for');
|
|
});
|
|
});
|
|
});
|
|
});
|