diff options
Diffstat (limited to 'spec/frontend/feature_flags/store/edit')
-rw-r--r-- | spec/frontend/feature_flags/store/edit/actions_spec.js | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/spec/frontend/feature_flags/store/edit/actions_spec.js b/spec/frontend/feature_flags/store/edit/actions_spec.js index 12fccd79170..b6114cb0c9f 100644 --- a/spec/frontend/feature_flags/store/edit/actions_spec.js +++ b/spec/frontend/feature_flags/store/edit/actions_spec.js @@ -40,7 +40,7 @@ describe('Feature flags Edit Module actions', () => { }); describe('success', () => { - it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', (done) => { + it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', () => { const featureFlag = { name: 'name', description: 'description', @@ -57,7 +57,7 @@ describe('Feature flags Edit Module actions', () => { }; mock.onPut(mockedState.endpoint, mapStrategiesToRails(featureFlag)).replyOnce(200); - testAction( + return testAction( updateFeatureFlag, featureFlag, mockedState, @@ -70,16 +70,15 @@ describe('Feature flags Edit Module actions', () => { type: 'receiveUpdateFeatureFlagSuccess', }, ], - done, ); }); }); describe('error', () => { - it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', (done) => { + it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', () => { mock.onPut(`${TEST_HOST}/endpoint.json`).replyOnce(500, { message: [] }); - testAction( + return testAction( updateFeatureFlag, { name: 'feature_flag', @@ -97,28 +96,26 @@ describe('Feature flags Edit Module actions', () => { payload: { message: [] }, }, ], - done, ); }); }); }); describe('requestUpdateFeatureFlag', () => { - it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', (done) => { - testAction( + it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', () => { + return testAction( requestUpdateFeatureFlag, null, mockedState, [{ type: types.REQUEST_UPDATE_FEATURE_FLAG }], [], - done, ); }); }); describe('receiveUpdateFeatureFlagSuccess', () => { - it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', (done) => { - testAction( + it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', () => { + return testAction( receiveUpdateFeatureFlagSuccess, null, mockedState, @@ -128,20 +125,18 @@ describe('Feature flags Edit Module actions', () => { }, ], [], - done, ); }); }); describe('receiveUpdateFeatureFlagError', () => { - it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', (done) => { - testAction( + it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', () => { + return testAction( receiveUpdateFeatureFlagError, 'There was an error', mockedState, [{ type: types.RECEIVE_UPDATE_FEATURE_FLAG_ERROR, payload: 'There was an error' }], [], - done, ); }); }); @@ -159,10 +154,10 @@ describe('Feature flags Edit Module actions', () => { }); describe('success', () => { - it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', (done) => { + it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', () => { mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 1 }); - testAction( + return testAction( fetchFeatureFlag, { id: 1 }, mockedState, @@ -176,16 +171,15 @@ describe('Feature flags Edit Module actions', () => { payload: { id: 1 }, }, ], - done, ); }); }); describe('error', () => { - it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', (done) => { + it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', () => { mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); - testAction( + return testAction( fetchFeatureFlag, null, mockedState, @@ -198,41 +192,38 @@ describe('Feature flags Edit Module actions', () => { type: 'receiveFeatureFlagError', }, ], - done, ); }); }); }); describe('requestFeatureFlag', () => { - it('should commit REQUEST_FEATURE_FLAG mutation', (done) => { - testAction( + it('should commit REQUEST_FEATURE_FLAG mutation', () => { + return testAction( requestFeatureFlag, null, mockedState, [{ type: types.REQUEST_FEATURE_FLAG }], [], - done, ); }); }); describe('receiveFeatureFlagSuccess', () => { - it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', (done) => { - testAction( + it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', () => { + return testAction( receiveFeatureFlagSuccess, { id: 1 }, mockedState, [{ type: types.RECEIVE_FEATURE_FLAG_SUCCESS, payload: { id: 1 } }], [], - done, ); }); }); describe('receiveFeatureFlagError', () => { - it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', (done) => { - testAction( + it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', () => { + return testAction( receiveFeatureFlagError, null, mockedState, @@ -242,20 +233,18 @@ describe('Feature flags Edit Module actions', () => { }, ], [], - done, ); }); }); describe('toggelActive', () => { - it('should commit TOGGLE_ACTIVE mutation', (done) => { - testAction( + it('should commit TOGGLE_ACTIVE mutation', () => { + return testAction( toggleActive, true, mockedState, [{ type: types.TOGGLE_ACTIVE, payload: true }], [], - done, ); }); }); |