From 598f1ae295c7cebd7c4af8b9a729ccfe14994ece Mon Sep 17 00:00:00 2001 From: CarlosMealha Date: Tue, 24 Jan 2023 16:18:09 +0000 Subject: [PATCH] test: adds showHidden test --- src/actions/searchOffersActions.js | 1 + src/reducers/searchOffersReducer.spec.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/actions/searchOffersActions.js b/src/actions/searchOffersActions.js index 6cce5f3e..2003e4eb 100644 --- a/src/actions/searchOffersActions.js +++ b/src/actions/searchOffersActions.js @@ -100,6 +100,7 @@ export const resetAdvancedSearchFields = () => (dispatch) => { dispatch(setJobDuration(INITIAL_JOB_DURATION, INITIAL_JOB_DURATION + 1)); dispatch(setFields([])); dispatch(setTechs([])); + dispatch(setShowHidden(false)); }; export const setShowHidden = (showHidden) => ({ diff --git a/src/reducers/searchOffersReducer.spec.js b/src/reducers/searchOffersReducer.spec.js index f213ae62..f4378de4 100644 --- a/src/reducers/searchOffersReducer.spec.js +++ b/src/reducers/searchOffersReducer.spec.js @@ -14,6 +14,7 @@ import { disableOffer, companyEnableOffer, adminEnableOffer, + setShowHidden, } from "../actions/searchOffersActions"; describe("Search Offers Reducer", () => { @@ -26,8 +27,10 @@ describe("Search Offers Reducer", () => { offers: [], fields: [], technologies: [], + showHidden: false, loading: false, - error: null }); + error: null, + }); }); it("should set offers when setSearchOffers action is called", () => { @@ -111,6 +114,17 @@ describe("Search Offers Reducer", () => { expect(state.fields).toStrictEqual(["test1", "test2"]); }); + it("should set advanced search fields when setShowHidden action is called", () => { + const state = searchOffersState( + { + showHidden: false, + }, + setShowHidden(true) + ); + + expect(state.showHidden).toBe(true); + }); + it("should set advanced search technologies when setTechs action is called", () => { const state = searchOffersState( {