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 92f8049 commit bcb8ca8
Show file tree
Hide file tree
Showing 3 changed files with 29 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
12 changes: 12 additions & 0 deletions src/components/HomePage/SearchArea/SearchArea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ describe("SearchArea", () => {
<RouteWrappedContent>
<SearchAreaWrapper
onSubmit={onSubmit}
fields={[]}
technologies={[]}
setShowJobDurationSlider={() => { }}
setTechs={() => { }}
setJobDuration={() => { }}
setFields={() => { }}
setJobType={() => { }}
setSearchValue={() => { }}
setShowHidden={() => { }}
/>
</RouteWrappedContent>,
{ initialState, theme }
Expand Down Expand Up @@ -197,6 +206,7 @@ describe("SearchArea", () => {
setJobDuration={() => { }}
setFields={() => { }}
setJobType={() => { }}
setShowHidden={() => { }}
onSubmit={onSubmit}
fields={[]}
technologies={[]}
Expand Down Expand Up @@ -272,6 +282,7 @@ describe("SearchArea", () => {
jobDuration: [1, 2],
fields: ["field1", "field2"],
technologies: ["tech1", "tech2"],
showHidden: true,
},
};
expect(mapStateToProps(mockState)).toEqual({
Expand All @@ -281,6 +292,7 @@ describe("SearchArea", () => {
jobMaxDuration: 2,
fields: ["field1", "field2"],
technologies: ["tech1", "tech2"],
showHidden: true,
});
});

Expand Down

0 comments on commit bcb8ca8

Please sign in to comment.