summaryrefslogtreecommitdiff
path: root/spec/frontend/contributors/store/actions_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/contributors/store/actions_spec.js')
-rw-r--r--spec/frontend/contributors/store/actions_spec.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/spec/frontend/contributors/store/actions_spec.js b/spec/frontend/contributors/store/actions_spec.js
index a4054ab1fc8..ef0ff8ca208 100644
--- a/spec/frontend/contributors/store/actions_spec.js
+++ b/spec/frontend/contributors/store/actions_spec.js
@@ -17,10 +17,14 @@ describe('Contributors store actions', () => {
mock = new MockAdapter(axios);
});
- it('should commit SET_CHART_DATA with received response', (done) => {
+ afterEach(() => {
+ mock.restore();
+ });
+
+ it('should commit SET_CHART_DATA with received response', () => {
mock.onGet().reply(200, chartData);
- testAction(
+ return testAction(
actions.fetchChartData,
{ endpoint },
{},
@@ -30,30 +34,22 @@ describe('Contributors store actions', () => {
{ type: types.SET_LOADING_STATE, payload: false },
],
[],
- () => {
- mock.restore();
- done();
- },
);
});
- it('should show flash on API error', (done) => {
+ it('should show flash on API error', async () => {
mock.onGet().reply(400, 'Not Found');
- testAction(
+ await testAction(
actions.fetchChartData,
{ endpoint },
{},
[{ type: types.SET_LOADING_STATE, payload: true }],
[],
- () => {
- expect(createFlash).toHaveBeenCalledWith({
- message: expect.stringMatching('error'),
- });
- mock.restore();
- done();
- },
);
+ expect(createFlash).toHaveBeenCalledWith({
+ message: expect.stringMatching('error'),
+ });
});
});
});