diff options
Diffstat (limited to 'spec/frontend/ide/stores/actions/file_spec.js')
-rw-r--r-- | spec/frontend/ide/stores/actions/file_spec.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/frontend/ide/stores/actions/file_spec.js b/spec/frontend/ide/stores/actions/file_spec.js index 8f7fcc25cf0..cc290fc526e 100644 --- a/spec/frontend/ide/stores/actions/file_spec.js +++ b/spec/frontend/ide/stores/actions/file_spec.js @@ -7,7 +7,7 @@ import * as types from '~/ide/stores/mutation_types'; import service from '~/ide/services'; import { createRouter } from '~/ide/ide_router'; import eventHub from '~/ide/eventhub'; -import { file } from '../../helpers'; +import { file, createTriggerRenameAction } from '../../helpers'; const ORIGINAL_CONTENT = 'original content'; const RELATIVE_URL_ROOT = '/gitlab'; @@ -785,13 +785,19 @@ describe('IDE store file actions', () => { }); describe('triggerFilesChange', () => { + const { payload: renamePayload } = createTriggerRenameAction('test', '123'); + beforeEach(() => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); }); - it('emits event that files have changed', () => { - return store.dispatch('triggerFilesChange').then(() => { - expect(eventHub.$emit).toHaveBeenCalledWith('ide.files.change'); + it.each` + args | payload + ${[]} | ${{}} + ${[renamePayload]} | ${renamePayload} + `('emits event that files have changed (args=$args)', ({ args, payload }) => { + return store.dispatch('triggerFilesChange', ...args).then(() => { + expect(eventHub.$emit).toHaveBeenCalledWith('ide.files.change', payload); }); }); }); |