import './index.js'; describe('InvoiceIn', () => { describe('Component vnInvoiceInCreate', () => { let $scope; let controller; beforeEach(ngModule('invoiceIn')); beforeEach(inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); $scope.card = {createInvoiceIn: () => {}}; const $element = angular.element(''); console.log($element); console.log($scope); controller = $componentController('vnInvoiceIn', {$element, $scope}); })); describe('onSubmit()', () => { it(`should call createInvoiceIn()`, () => { jest.spyOn(controller, 'createOrder'); controller.onSubmit(); expect(controller.createOrder).toHaveBeenCalledWith(); }); it(`should call go()`, async() => { jest.spyOn(controller.$state, 'go'); await controller.onSubmit(); expect(controller.$state.go).toHaveBeenCalledWith('order.invoiceIn.summary', {id: undefined}); }); }); describe('set companyFk', () => { it(`should set companyFk to a value`, () => { controller.companyFk = 442; expect(controller.companyFk).toEqual(442); }); }); }); });