diff --git a/client/ticket/src/create/index.spec.js b/client/ticket/src/create/index.spec.js new file mode 100644 index 000000000..468e648eb --- /dev/null +++ b/client/ticket/src/create/index.spec.js @@ -0,0 +1,41 @@ +import './index.js'; + +describe('Ticket', () => { + describe('Component vnTicketCreate', () => { + let $componentController; + let $scope; + let controller; + let $state; + + beforeEach(() => { + angular.mock.module('ticket'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => { + $componentController = _$componentController_; + + $scope = $rootScope.$new(); + $scope.card = {createTicket: () => {}}; + $state = _$state_; + $state.go = () => {}; + controller = $componentController('vnTicketCreate', {$scope: $scope, $state: $state}); + })); + + describe('onSubmit()', () => { + it(`should call createTicket()`, () => { + spyOn(controller.$.card, 'createTicket'); + controller.onSubmit(); + + expect(controller.$.card.createTicket).toHaveBeenCalledWith(); + }); + + xit(`should call go()`, () => { + spyOn(controller.$state, 'go'); + controller.onSubmit(); + + expect(controller.$state.go).toHaveBeenCalledWith(); + }); + }); + }); +}); + diff --git a/client/ticket/src/sale/index.html b/client/ticket/src/sale/index.html index b6b0566b7..598e6cb67 100644 --- a/client/ticket/src/sale/index.html +++ b/client/ticket/src/sale/index.html @@ -59,10 +59,11 @@