diff options
Diffstat (limited to 'spec/javascripts/notes/stores/actions_spec.js')
-rw-r--r-- | spec/javascripts/notes/stores/actions_spec.js | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/spec/javascripts/notes/stores/actions_spec.js b/spec/javascripts/notes/stores/actions_spec.js index 520a25cc5c6..985c2f81ef3 100644 --- a/spec/javascripts/notes/stores/actions_spec.js +++ b/spec/javascripts/notes/stores/actions_spec.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import _ from 'underscore'; import { headersInterceptor } from 'spec/helpers/vue_resource_helper'; import * as actions from '~/notes/stores/actions'; -import store from '~/notes/stores'; +import createStore from '~/notes/stores'; import testAction from '../../helpers/vuex_action_helper'; import { resetStore } from '../helpers'; import { @@ -14,6 +14,12 @@ import { } from '../mock_data'; describe('Actions Notes Store', () => { + let store; + + beforeEach(() => { + store = createStore(); + }); + afterEach(() => { resetStore(store); }); @@ -76,7 +82,7 @@ describe('Actions Notes Store', () => { actions.setInitialNotes, [individualNote], { notes: [] }, - [{ type: 'SET_INITIAL_NOTES', payload: [individualNote] }], + [{ type: 'SET_INITIAL_DISCUSSIONS', payload: [individualNote] }], [], done, ); @@ -109,6 +115,19 @@ describe('Actions Notes Store', () => { }); }); + describe('expandDiscussion', () => { + it('should expand discussion', done => { + testAction( + actions.expandDiscussion, + { discussionId: discussionMock.id }, + { notes: [discussionMock] }, + [{ type: 'EXPAND_DISCUSSION', payload: { discussionId: discussionMock.id } }], + [], + done, + ); + }); + }); + describe('async methods', () => { const interceptor = (request, next) => { next( @@ -194,7 +213,14 @@ describe('Actions Notes Store', () => { }); it('sets issue state as reopened', done => { - testAction(actions.toggleIssueLocalState, 'reopened', {}, [{ type: 'REOPEN_ISSUE' }], [], done); + testAction( + actions.toggleIssueLocalState, + 'reopened', + {}, + [{ type: 'REOPEN_ISSUE' }], + [], + done, + ); }); }); @@ -239,13 +265,7 @@ describe('Actions Notes Store', () => { .dispatch('poll') .then(() => new Promise(resolve => requestAnimationFrame(resolve))) .then(() => { - expect(Vue.http.get).toHaveBeenCalledWith(jasmine.anything(), { - url: jasmine.anything(), - method: 'get', - headers: { - 'X-Last-Fetched-At': undefined, - }, - }); + expect(Vue.http.get).toHaveBeenCalled(); expect(store.state.lastFetchedAt).toBe('123456'); jasmine.clock().tick(1500); |