Skip to content

Commit

Permalink
Task: response area expanded slice (#3267)
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome authored Jul 25, 2024
1 parent 0c217d9 commit 47fe5f1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { RESPONSE_EXPANDED } from '../../../app/services/redux-constants';
import { expandResponseArea } from '../../../app/services/actions/response-expanded-action-creator';
import { AppAction } from '../../../types/action';
import { expandResponseArea } from '../slices/response-area-expanded.slice';

describe('Response Area Expansion', () => {
it('should dispatch RESPONSE_EXPANDED when expandResponseArea() is called', () => {
//Arrange
const response: boolean = true;
const payload: boolean = true;

const expectedAction: AppAction = {
type: RESPONSE_EXPANDED,
response
payload
}

// Act
const action = expandResponseArea(response);
const action = expandResponseArea(payload);

// Assert
expect(action).toEqual(expectedAction);
Expand Down
9 changes: 0 additions & 9 deletions src/app/services/actions/response-expanded-action-creator.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/services/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import permissionGrants from '../slices/permission-grants.slice';
import profile from '../slices/profile.slice';
import proxyUrl from '../slices/proxy.slice';
import resources from '../slices/resources.slice';
import responseAreaExpanded from '../slices/response-area-expanded.slice';
import sampleQuery from '../slices/sample-query.slice';
import samplesReducer from '../slices/samples.slice';
import scopes from '../slices/scopes.slice';
import snippets from '../slices/snippet.slice';
import themeChange from '../slices/theme.slice';

import { queryRunnerStatus } from './query-runner-status-reducers';
import { responseAreaExpanded } from './response-expanded-reducer';
import { termsOfUse } from './terms-of-use-reducer';
import { sidebarProperties } from './toggle-sidebar-reducer';

Expand Down
12 changes: 0 additions & 12 deletions src/app/services/reducers/response-expanded-reducer.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/services/redux-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const AUTOCOMPLETE_FETCH_SUCCESS = 'autoComplete/fetch/fulfilled';
export const AUTOCOMPLETE_FETCH_ERROR = 'autoComplete/fetch/rejected';
export const AUTOCOMPLETE_FETCH_PENDING = 'autoComplete/fetch/pending';
export const RESIZE_SUCCESS = 'dimensions/resizeSuccess';
export const RESPONSE_EXPANDED = 'RESPONSE_EXPANDED';
export const RESPONSE_EXPANDED = 'responseAreaExpanded/expandResponseArea';
export const PERMISSIONS_PANEL_OPEN = 'PERMISSIONS_PANEL_OPEN';
export const AUTHENTICATION_PENDING = 'auth/setAuthenticationPending';
export const FETCH_RESOURCES_SUCCESS = 'resources/fetchResources/fulfilled';
Expand Down
12 changes: 12 additions & 0 deletions src/app/services/slices/response-area-expanded.slice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';

const responseAreaExpandedSlice = createSlice({
name: 'responseAreaExpanded',
initialState: false,
reducers: {
expandResponseArea: (_, action: PayloadAction<boolean>) => action.payload
}
})

export const { expandResponseArea } = responseAreaExpandedSlice.actions
export default responseAreaExpandedSlice.reducer;
2 changes: 1 addition & 1 deletion src/app/views/query-response/QueryResponse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useDispatch } from 'react-redux';
import { AppDispatch, useAppSelector } from '../../../store';
import { telemetry } from '../../../telemetry';
import { IQuery } from '../../../types/query-runner';
import { expandResponseArea } from '../../services/actions/response-expanded-action-creator';
import { expandResponseArea } from '../../services/slices/response-area-expanded.slice';
import { translateMessage } from '../../utils/translate-messages';
import { convertVhToPx } from '../common/dimensions/dimensions-adjustment';
import { GetPivotItems } from './pivot-items/pivot-items';
Expand Down

0 comments on commit 47fe5f1

Please sign in to comment.