36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import './index.js';
|
|
|
|
describe('Order', () => {
|
|
describe('Component vnOrderCreate', () => {
|
|
let $scope;
|
|
let controller;
|
|
|
|
beforeEach(angular.mock.module('order', $translateProvider => {
|
|
$translateProvider.translations('en', {});
|
|
}));
|
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
|
$scope = $rootScope.$new();
|
|
$scope.card = {createOrder: () => {}};
|
|
controller = $componentController('vnOrderCreate', {$scope});
|
|
}));
|
|
|
|
describe('onSubmit()', () => {
|
|
it(`should call createOrder()`, () => {
|
|
spyOn(controller.$.card, 'createOrder');
|
|
controller.onSubmit();
|
|
|
|
expect(controller.$.card.createOrder).toHaveBeenCalledWith();
|
|
});
|
|
|
|
it(`should call go()`, async() => {
|
|
spyOn(controller.$state, 'go');
|
|
await controller.onSubmit();
|
|
|
|
expect(controller.$state.go).toHaveBeenCalledWith('order.card.summary', {id: undefined});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|