29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
import './index.js';
|
|
|
|
describe('Travel Component vnTravelBasicData', () => {
|
|
let controller;
|
|
|
|
beforeEach(angular.mock.module('travel', $translateProvider => {
|
|
$translateProvider.translations('en', {});
|
|
}));
|
|
|
|
beforeEach(angular.mock.inject($componentController => {
|
|
const $element = angular.element('<vn-travel-basic-data></vn-travel-basic-data>');
|
|
controller = $componentController('vnTravelBasicData', {$element});
|
|
controller.card = {reload: () => {}};
|
|
controller.$.watcher = {submit: () => {}};
|
|
}));
|
|
|
|
describe('onSubmit()', () => {
|
|
it('should call the card reload method after the watcher submits', done => {
|
|
jest.spyOn(controller.card, 'reload');
|
|
jest.spyOn(controller.$.watcher, 'submit').mockReturnValue(Promise.resolve());
|
|
|
|
controller.onSubmit().then(() => {
|
|
expect(controller.card.reload).toHaveBeenCalledWith();
|
|
done();
|
|
}).catch(done.fail);
|
|
});
|
|
});
|
|
});
|