summaryrefslogtreecommitdiff
path: root/spec/frontend/feature_flags/store/index/actions_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/feature_flags/store/index/actions_spec.js')
-rw-r--r--spec/frontend/feature_flags/store/index/actions_spec.js86
1 files changed, 35 insertions, 51 deletions
diff --git a/spec/frontend/feature_flags/store/index/actions_spec.js b/spec/frontend/feature_flags/store/index/actions_spec.js
index a59f99f538c..ce62c3b0473 100644
--- a/spec/frontend/feature_flags/store/index/actions_spec.js
+++ b/spec/frontend/feature_flags/store/index/actions_spec.js
@@ -32,14 +32,13 @@ describe('Feature flags actions', () => {
});
describe('setFeatureFlagsOptions', () => {
- it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', (done) => {
- testAction(
+ it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', () => {
+ return testAction(
setFeatureFlagsOptions,
{ page: '1', scope: 'all' },
mockedState,
[{ type: types.SET_FEATURE_FLAGS_OPTIONS, payload: { page: '1', scope: 'all' } }],
[],
- done,
);
});
});
@@ -57,10 +56,10 @@ describe('Feature flags actions', () => {
});
describe('success', () => {
- it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', (done) => {
+ it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', () => {
mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, getRequestData, {});
- testAction(
+ return testAction(
fetchFeatureFlags,
null,
mockedState,
@@ -74,16 +73,15 @@ describe('Feature flags actions', () => {
type: 'receiveFeatureFlagsSuccess',
},
],
- done,
);
});
});
describe('error', () => {
- it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', (done) => {
+ it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', () => {
mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {});
- testAction(
+ return testAction(
fetchFeatureFlags,
null,
mockedState,
@@ -96,28 +94,26 @@ describe('Feature flags actions', () => {
type: 'receiveFeatureFlagsError',
},
],
- done,
);
});
});
});
describe('requestFeatureFlags', () => {
- it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => {
- testAction(
+ it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', () => {
+ return testAction(
requestFeatureFlags,
null,
mockedState,
[{ type: types.REQUEST_FEATURE_FLAGS }],
[],
- done,
);
});
});
describe('receiveFeatureFlagsSuccess', () => {
- it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => {
- testAction(
+ it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', () => {
+ return testAction(
receiveFeatureFlagsSuccess,
{ data: getRequestData, headers: {} },
mockedState,
@@ -128,20 +124,18 @@ describe('Feature flags actions', () => {
},
],
[],
- done,
);
});
});
describe('receiveFeatureFlagsError', () => {
- it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', (done) => {
- testAction(
+ it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', () => {
+ return testAction(
receiveFeatureFlagsError,
null,
mockedState,
[{ type: types.RECEIVE_FEATURE_FLAGS_ERROR }],
[],
- done,
);
});
});
@@ -159,10 +153,10 @@ describe('Feature flags actions', () => {
});
describe('success', () => {
- it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', (done) => {
+ it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', () => {
mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(200, rotateData, {});
- testAction(
+ return testAction(
rotateInstanceId,
null,
mockedState,
@@ -176,16 +170,15 @@ describe('Feature flags actions', () => {
type: 'receiveRotateInstanceIdSuccess',
},
],
- done,
);
});
});
describe('error', () => {
- it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', (done) => {
+ it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', () => {
mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {});
- testAction(
+ return testAction(
rotateInstanceId,
null,
mockedState,
@@ -198,28 +191,26 @@ describe('Feature flags actions', () => {
type: 'receiveRotateInstanceIdError',
},
],
- done,
);
});
});
});
describe('requestRotateInstanceId', () => {
- it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', (done) => {
- testAction(
+ it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', () => {
+ return testAction(
requestRotateInstanceId,
null,
mockedState,
[{ type: types.REQUEST_ROTATE_INSTANCE_ID }],
[],
- done,
);
});
});
describe('receiveRotateInstanceIdSuccess', () => {
- it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', (done) => {
- testAction(
+ it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', () => {
+ return testAction(
receiveRotateInstanceIdSuccess,
{ data: rotateData, headers: {} },
mockedState,
@@ -230,20 +221,18 @@ describe('Feature flags actions', () => {
},
],
[],
- done,
);
});
});
describe('receiveRotateInstanceIdError', () => {
- it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', (done) => {
- testAction(
+ it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', () => {
+ return testAction(
receiveRotateInstanceIdError,
null,
mockedState,
[{ type: types.RECEIVE_ROTATE_INSTANCE_ID_ERROR }],
[],
- done,
);
});
});
@@ -262,10 +251,10 @@ describe('Feature flags actions', () => {
mock.restore();
});
describe('success', () => {
- it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => {
+ it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', () => {
mock.onPut(featureFlag.update_path).replyOnce(200, featureFlag, {});
- testAction(
+ return testAction(
toggleFeatureFlag,
featureFlag,
mockedState,
@@ -280,15 +269,15 @@ describe('Feature flags actions', () => {
type: 'receiveUpdateFeatureFlagSuccess',
},
],
- done,
);
});
});
+
describe('error', () => {
- it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => {
+ it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', () => {
mock.onPut(featureFlag.update_path).replyOnce(500);
- testAction(
+ return testAction(
toggleFeatureFlag,
featureFlag,
mockedState,
@@ -303,7 +292,6 @@ describe('Feature flags actions', () => {
type: 'receiveUpdateFeatureFlagError',
},
],
- done,
);
});
});
@@ -315,8 +303,8 @@ describe('Feature flags actions', () => {
}));
});
- it('commits UPDATE_FEATURE_FLAG with the given flag', (done) => {
- testAction(
+ it('commits UPDATE_FEATURE_FLAG with the given flag', () => {
+ return testAction(
updateFeatureFlag,
featureFlag,
mockedState,
@@ -327,7 +315,6 @@ describe('Feature flags actions', () => {
},
],
[],
- done,
);
});
});
@@ -338,8 +325,8 @@ describe('Feature flags actions', () => {
}));
});
- it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', (done) => {
- testAction(
+ it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', () => {
+ return testAction(
receiveUpdateFeatureFlagSuccess,
featureFlag,
mockedState,
@@ -350,7 +337,6 @@ describe('Feature flags actions', () => {
},
],
[],
- done,
);
});
});
@@ -361,8 +347,8 @@ describe('Feature flags actions', () => {
}));
});
- it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', (done) => {
- testAction(
+ it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', () => {
+ return testAction(
receiveUpdateFeatureFlagError,
featureFlag.id,
mockedState,
@@ -373,22 +359,20 @@ describe('Feature flags actions', () => {
},
],
[],
- done,
);
});
});
describe('clearAlert', () => {
- it('should commit RECEIVE_CLEAR_ALERT', (done) => {
+ it('should commit RECEIVE_CLEAR_ALERT', () => {
const alertIndex = 3;
- testAction(
+ return testAction(
clearAlert,
alertIndex,
mockedState,
[{ type: 'RECEIVE_CLEAR_ALERT', payload: alertIndex }],
[],
- done,
);
});
});