29 lines
985 B
JavaScript
29 lines
985 B
JavaScript
|
import './index.js';
|
||
|
|
||
|
describe('Travel Component vnTravelBasicData', () => {
|
||
|
let controller;
|
||
|
let $scope;
|
||
|
beforeEach(angular.mock.module('travel', $translateProvider => {
|
||
|
$translateProvider.translations('en', {});
|
||
|
}));
|
||
|
|
||
|
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||
|
$scope = $rootScope.$new();
|
||
|
controller = $componentController('vnTravelBasicData', $scope);
|
||
|
controller.card = {reload: () => {}};
|
||
|
controller.$.watcher = {submit: () => {}};
|
||
|
}));
|
||
|
|
||
|
describe('onSubmit()', () => {
|
||
|
it('should call the card reload method after the watcher submits', done => {
|
||
|
spyOn(controller.card, 'reload');
|
||
|
spyOn(controller.$.watcher, 'submit').and.returnValue(Promise.resolve());
|
||
|
|
||
|
controller.onSubmit().then(() => {
|
||
|
expect(controller.card.reload).toHaveBeenCalledWith();
|
||
|
done();
|
||
|
}).catch(done.fail);
|
||
|
});
|
||
|
});
|
||
|
});
|