salix/modules/invoiceIn/front/card/index.spec.js

34 lines
913 B
JavaScript
Raw Normal View History

2021-03-03 06:44:09 +00:00
import './index.js';
describe('vnInvoiceIn', () => {
let controller;
let $httpBackend;
const expectedAmount = 99;
const data = {
id: 1,
name: 'fooName',
invoiceInDueDay: [{amount: expectedAmount}]
};
2021-03-03 06:44:09 +00:00
beforeEach(ngModule('invoiceIn'));
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('<div></div>');
controller = $componentController('vnInvoiceInCard', {$element});
$stateParams.id = data.id;
$httpBackend.whenRoute('GET', 'InvoiceIns/:id').respond(data);
}));
it('should request data and set it on the controller', () => {
controller.reload();
$httpBackend.flush();
expect(controller.invoiceIn).toBeDefined();
expect(controller.invoiceIn.amount).toEqual(expectedAmount);
2021-03-03 06:44:09 +00:00
});
});