Skip to content

Commit

Permalink
tests: adds various tests to showHidden
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosMealha committed Feb 7, 2023
1 parent 598f1ae commit 726749a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/actions/searchOffersActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export const adminEnableOffer = (offerIdx) => ({
offerIdx,
});

export const setShowHidden = (showHidden) => ({
type: OfferSearchTypes.SET_SHOW_HIDDEN,
showHidden,
});

export const resetAdvancedSearchFields = () => (dispatch) => {
dispatch(setJobType(INITIAL_JOB_TYPE));
dispatch(setShowJobDurationSlider(false));
Expand All @@ -102,8 +107,3 @@ export const resetAdvancedSearchFields = () => (dispatch) => {
dispatch(setTechs([]));
dispatch(setShowHidden(false));
};

export const setShowHidden = (showHidden) => ({
type: OfferSearchTypes.SET_SHOW_HIDDEN,
showHidden,
});
12 changes: 12 additions & 0 deletions src/actions/searchOffersActions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
resetAdvancedSearchFields,
setOffersFetchError,
resetOffersFetchError,
setShowHidden,
} from "./searchOffersActions";

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

it("should return Set Show Hidden action", () => {

const showHidden = "show_hidden";
const expectedAction = {
type: OfferSearchTypes.SET_SHOW_HIDDEN,
showHidden,
};

expect(setShowHidden(showHidden)).toEqual(expectedAction);
});

it("should return Set Job Duration action", () => {

const jobDuration = [1, 2];
Expand Down
4 changes: 4 additions & 0 deletions src/components/HomePage/SearchArea/SearchArea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe("SearchArea", () => {
setFields={() => { }}
setJobType={() => { }}
setSearchValue={() => { }}
setShowHidden={() => { }}
/>
</RouteWrappedContent>,
{ initialState, theme }
Expand Down Expand Up @@ -80,6 +81,7 @@ describe("SearchArea", () => {
setJobDuration={() => { }}
setFields={() => { }}
setJobType={() => { }}
setShowHidden={() => { }}
onSubmit={onSubmit}
fields={[]}
technologies={[]}
Expand Down Expand Up @@ -157,6 +159,7 @@ describe("SearchArea", () => {
jobDuration: [1, 2],
fields: ["field1", "field2"],
technologies: ["tech1", "tech2"],
showHidden: true,
},
};
expect(mapStateToProps(mockState)).toEqual({
Expand All @@ -166,6 +169,7 @@ describe("SearchArea", () => {
jobMaxDuration: 2,
fields: ["field1", "field2"],
technologies: ["tech1", "tech2"],
showHidden: true,
});
});

Expand Down

0 comments on commit 726749a

Please sign in to comment.