28 lines
741 B
JavaScript
28 lines
741 B
JavaScript
|
import './index.js';
|
||
|
|
||
|
describe('vnInvoiceOut', () => {
|
||
|
let controller;
|
||
|
let $httpBackend;
|
||
|
let data = {id: 1, name: 'fooName'};
|
||
|
|
||
|
beforeEach(ngModule('invoiceOut'));
|
||
|
|
||
|
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
||
|
$httpBackend = _$httpBackend_;
|
||
|
|
||
|
let $element = angular.element('<div></div>');
|
||
|
controller = $componentController('vnInvoiceOutCard', {$element});
|
||
|
|
||
|
$stateParams.id = data.id;
|
||
|
$httpBackend.whenRoute('GET', 'InvoiceOuts/:id').respond(data);
|
||
|
}));
|
||
|
|
||
|
it('should request data and set it on the controller', () => {
|
||
|
controller.reload();
|
||
|
$httpBackend.flush();
|
||
|
|
||
|
expect(controller.invoiceOut).toEqual(data);
|
||
|
});
|
||
|
});
|
||
|
|