diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-09-20 19:03:53 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-09-20 19:03:53 +0100 |
commit | ee3cf5d6f3d5a3631fa7e94a242f2dfe9b38a935 (patch) | |
tree | 855937f227caaac46688dca63f82a18598be778b /spec/javascripts/notes | |
parent | 6c63520ef5735e56749c77b495f8137a20942504 (diff) | |
download | gitlab-ce-ee3cf5d6f3d5a3631fa7e94a242f2dfe9b38a935.tar.gz |
[ci skip] Adds tests to vuex and collapsibe component
Formats dates
Fixes clipboard button
Simplifies HTML
Diffstat (limited to 'spec/javascripts/notes')
-rw-r--r-- | spec/javascripts/notes/stores/actions_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/notes/stores/helpers.js | 37 |
2 files changed, 1 insertions, 38 deletions
diff --git a/spec/javascripts/notes/stores/actions_spec.js b/spec/javascripts/notes/stores/actions_spec.js index 72d362acb2f..4359899299f 100644 --- a/spec/javascripts/notes/stores/actions_spec.js +++ b/spec/javascripts/notes/stores/actions_spec.js @@ -1,6 +1,6 @@ import * as actions from '~/notes/stores/actions'; -import testAction from './helpers'; +import testAction from '../../helpers/vuex_action_helper'; import { discussionMock, notesDataMock, userDataMock, issueDataMock, individualNote } from '../mock_data'; describe('Actions Notes Store', () => { diff --git a/spec/javascripts/notes/stores/helpers.js b/spec/javascripts/notes/stores/helpers.js deleted file mode 100644 index 2d386fe1da5..00000000000 --- a/spec/javascripts/notes/stores/helpers.js +++ /dev/null @@ -1,37 +0,0 @@ -/* eslint-disable */ - -/** - * helper for testing action with expected mutations - * https://vuex.vuejs.org/en/testing.html - */ -export default (action, payload, state, expectedMutations, done) => { - let count = 0; - - // mock commit - const commit = (type, payload) => { - const mutation = expectedMutations[count]; - - try { - expect(mutation.type).to.equal(type); - if (payload) { - expect(mutation.payload).to.deep.equal(payload); - } - } catch (error) { - done(error); - } - - count++; - if (count >= expectedMutations.length) { - done(); - } - }; - - // call the action with mocked store and arguments - action({ commit, state }, payload); - - // check if no mutations should have been dispatched - if (expectedMutations.length === 0) { - expect(count).to.equal(0); - done(); - } -}; |