fixed error_message_spec

This commit is contained in:
Phil Hughes 2018-06-28 12:41:53 +01:00
parent 8b687e07d7
commit d255fd4f46
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
1 changed files with 7 additions and 5 deletions

View File

@ -36,13 +36,15 @@ describe('IDE error message component', () => {
}); });
describe('with action', () => { describe('with action', () => {
let actionSpy;
beforeEach(done => { beforeEach(done => {
vm.message.action = 'testAction'; actionSpy = jasmine.createSpy('action').and.returnValue(Promise.resolve());
vm.message.action = actionSpy;
vm.message.actionText = 'test action'; vm.message.actionText = 'test action';
vm.message.actionPayload = 'testActionPayload'; vm.message.actionPayload = 'testActionPayload';
spyOn(vm.$store, 'dispatch').and.returnValue(Promise.resolve());
vm.$nextTick(done); vm.$nextTick(done);
}); });
@ -63,7 +65,7 @@ describe('IDE error message component', () => {
vm.$el.querySelector('.flash-action').click(); vm.$el.querySelector('.flash-action').click();
vm.$nextTick(() => { vm.$nextTick(() => {
expect(vm.$store.dispatch).toHaveBeenCalledWith('testAction', 'testActionPayload'); expect(actionSpy).toHaveBeenCalledWith('testActionPayload');
done(); done();
}); });
@ -74,7 +76,7 @@ describe('IDE error message component', () => {
vm.$el.querySelector('.flash-action').click(); vm.$el.querySelector('.flash-action').click();
expect(vm.$store.dispatch).not.toHaveBeenCalledWith(); expect(actionSpy).not.toHaveBeenCalledWith();
}); });
it('resets isLoading after click', done => { it('resets isLoading after click', done => {