Skip to content

Commit 726749a

Browse files
committed
tests: adds various tests to showHidden
1 parent 598f1ae commit 726749a

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/actions/searchOffersActions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ export const adminEnableOffer = (offerIdx) => ({
9494
offerIdx,
9595
});
9696

97+
export const setShowHidden = (showHidden) => ({
98+
type: OfferSearchTypes.SET_SHOW_HIDDEN,
99+
showHidden,
100+
});
101+
97102
export const resetAdvancedSearchFields = () => (dispatch) => {
98103
dispatch(setJobType(INITIAL_JOB_TYPE));
99104
dispatch(setShowJobDurationSlider(false));
@@ -102,8 +107,3 @@ export const resetAdvancedSearchFields = () => (dispatch) => {
102107
dispatch(setTechs([]));
103108
dispatch(setShowHidden(false));
104109
};
105-
106-
export const setShowHidden = (showHidden) => ({
107-
type: OfferSearchTypes.SET_SHOW_HIDDEN,
108-
showHidden,
109-
});

src/actions/searchOffersActions.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
resetAdvancedSearchFields,
1313
setOffersFetchError,
1414
resetOffersFetchError,
15+
setShowHidden,
1516
} from "./searchOffersActions";
1617

1718
import { INITIAL_JOB_TYPE, INITIAL_JOB_DURATION } from "../reducers/searchOffersReducer";
@@ -54,6 +55,17 @@ describe("Search Offers actions", () => {
5455
expect(setSearchValue(value)).toEqual(expectedAction);
5556
});
5657

58+
it("should return Set Show Hidden action", () => {
59+
60+
const showHidden = "show_hidden";
61+
const expectedAction = {
62+
type: OfferSearchTypes.SET_SHOW_HIDDEN,
63+
showHidden,
64+
};
65+
66+
expect(setShowHidden(showHidden)).toEqual(expectedAction);
67+
});
68+
5769
it("should return Set Job Duration action", () => {
5870

5971
const jobDuration = [1, 2];

src/components/HomePage/SearchArea/SearchArea.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe("SearchArea", () => {
4444
setFields={() => { }}
4545
setJobType={() => { }}
4646
setSearchValue={() => { }}
47+
setShowHidden={() => { }}
4748
/>
4849
</RouteWrappedContent>,
4950
{ initialState, theme }
@@ -80,6 +81,7 @@ describe("SearchArea", () => {
8081
setJobDuration={() => { }}
8182
setFields={() => { }}
8283
setJobType={() => { }}
84+
setShowHidden={() => { }}
8385
onSubmit={onSubmit}
8486
fields={[]}
8587
technologies={[]}
@@ -157,6 +159,7 @@ describe("SearchArea", () => {
157159
jobDuration: [1, 2],
158160
fields: ["field1", "field2"],
159161
technologies: ["tech1", "tech2"],
162+
showHidden: true,
160163
},
161164
};
162165
expect(mapStateToProps(mockState)).toEqual({
@@ -166,6 +169,7 @@ describe("SearchArea", () => {
166169
jobMaxDuration: 2,
167170
fields: ["field1", "field2"],
168171
technologies: ["tech1", "tech2"],
172+
showHidden: true,
169173
});
170174
});
171175

0 commit comments

Comments
 (0)