diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-19 12:08:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-19 12:08:55 +0300 |
commit | 541758119cb1a4e029a2d0fb0551f52f6cf9a511 (patch) | |
tree | e4c12b348f5cc115d96ed38a1b71a9e47e593ed0 /spec/frontend/code_navigation | |
parent | 6733a7a15ceefcf4802e44f96d66a9ddd7881635 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/code_navigation')
-rw-r--r-- | spec/frontend/code_navigation/store/actions_spec.js | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/spec/frontend/code_navigation/store/actions_spec.js b/spec/frontend/code_navigation/store/actions_spec.js index af4794eb023..c26416aca94 100644 --- a/spec/frontend/code_navigation/store/actions_spec.js +++ b/spec/frontend/code_navigation/store/actions_spec.js @@ -10,14 +10,13 @@ describe('Code navigation actions', () => { const wrapTextNodes = true; describe('setInitialData', () => { - it('commits SET_INITIAL_DATA', (done) => { - testAction( + it('commits SET_INITIAL_DATA', () => { + return testAction( actions.setInitialData, { projectPath: 'test', wrapTextNodes }, {}, [{ type: 'SET_INITIAL_DATA', payload: { projectPath: 'test', wrapTextNodes } }], [], - done, ); }); }); @@ -59,8 +58,8 @@ describe('Code navigation actions', () => { ]); }); - it('commits REQUEST_DATA_SUCCESS with normalized data', (done) => { - testAction( + it('commits REQUEST_DATA_SUCCESS with normalized data', () => { + return testAction( actions.fetchData, null, state, @@ -82,12 +81,11 @@ describe('Code navigation actions', () => { }, ], [], - done, ); }); - it('calls addInteractionClass with data', (done) => { - testAction( + it('calls addInteractionClass with data', () => { + return testAction( actions.fetchData, null, state, @@ -109,20 +107,17 @@ describe('Code navigation actions', () => { }, ], [], - ) - .then(() => { - expect(addInteractionClass).toHaveBeenCalledWith({ - path: 'index.js', - d: { - start_line: 0, - start_char: 0, - hover: { value: '123' }, - }, - wrapTextNodes, - }); - }) - .then(done) - .catch(done.fail); + ).then(() => { + expect(addInteractionClass).toHaveBeenCalledWith({ + path: 'index.js', + d: { + start_line: 0, + start_char: 0, + hover: { value: '123' }, + }, + wrapTextNodes, + }); + }); }); }); @@ -131,14 +126,13 @@ describe('Code navigation actions', () => { mock.onGet(codeNavigationPath).replyOnce(500); }); - it('dispatches requestDataError', (done) => { - testAction( + it('dispatches requestDataError', () => { + return testAction( actions.fetchData, null, state, [{ type: 'REQUEST_DATA' }], [{ type: 'requestDataError' }], - done, ); }); }); @@ -186,20 +180,20 @@ describe('Code navigation actions', () => { target = document.querySelector('.js-test'); }); - it('returns early when no data exists', (done) => { - testAction(actions.showDefinition, { target }, {}, [], [], done); + it('returns early when no data exists', () => { + return testAction(actions.showDefinition, { target }, {}, [], []); }); - it('commits SET_CURRENT_DEFINITION when target is not code navitation element', (done) => { - testAction(actions.showDefinition, { target }, { data: {} }, [], [], done); + it('commits SET_CURRENT_DEFINITION when target is not code navitation element', () => { + return testAction(actions.showDefinition, { target }, { data: {} }, [], []); }); - it('commits SET_CURRENT_DEFINITION with LSIF data', (done) => { + it('commits SET_CURRENT_DEFINITION with LSIF data', () => { target.classList.add('js-code-navigation'); target.setAttribute('data-line-index', '0'); target.setAttribute('data-char-index', '0'); - testAction( + return testAction( actions.showDefinition, { target }, { data: { 'index.js': { '0:0': { hover: 'test' } } } }, @@ -214,7 +208,6 @@ describe('Code navigation actions', () => { }, ], [], - done, ); }); |