Commit b25c3ba2 authored by NataliaTepluhina's avatar NataliaTepluhina Committed by Heinrich Lee Yu

Added unit test for fetchDiscussions

parent 674fe50e
......@@ -1395,4 +1395,45 @@ describe('Actions Notes Store', () => {
);
});
});
describe('fetchDiscussions', () => {
const discussion = { notes: [] };
afterEach(() => {
window.gon = {};
});
it('updates the discussions and dispatches `updateResolvableDiscussionsCounts`', (done) => {
axiosMock.onAny().reply(200, { discussion });
testAction(
actions.fetchDiscussions,
true,
null,
[
{ type: mutationTypes.ADD_OR_UPDATE_DISCUSSIONS, payload: { discussion } },
{ type: mutationTypes.SET_FETCHING_DISCUSSIONS, payload: false },
],
[{ type: 'updateResolvableDiscussionsCounts' }],
done,
);
});
it('dispatches `fetchDiscussionsBatch` action if `paginatedIssueDiscussions` feature flag is enabled', (done) => {
window.gon = { features: { paginatedIssueDiscussions: true } };
testAction(
actions.fetchDiscussions,
true,
null,
[],
[
{
type: 'fetchDiscussionsBatch',
payload: { config: null, path: undefined, perPage: 20 },
},
],
done,
);
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment