Skip to content

Commit 695e803

Browse files
committed
test: adds more showHidden tests
Co-authored-by: Diogo Fonte diogo.fonte2000@gmail.com
1 parent 02e4711 commit 695e803

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/actions/searchOffersActions.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("Search Offers actions", () => {
5757

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

60-
const showHidden = "show_hidden";
60+
const showHidden = true;
6161
const expectedAction = {
6262
type: OfferSearchTypes.SET_SHOW_HIDDEN,
6363
showHidden,

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
setFields,
88
setTechs,
99
setShowJobDurationSlider,
10+
setShowHidden,
1011
} from "../../../actions/searchOffersActions";
1112
import { createTheme } from "@material-ui/core";
1213
import { renderWithStoreAndTheme, screen, fireEvent, act } from "../../../test-utils";
@@ -28,7 +29,7 @@ const SearchAreaWrapper = ({
2829
searchValue = "", jobType = INITIAL_JOB_TYPE, jobDuration = [null, null], filterJobDuration = false,
2930
showJobDurationSlider = false, fields = [], technologies = [], setShowJobDurationSlider = () => { },
3031
setTechs = () => { }, setJobDuration = () => { }, setFields = () => { }, setJobType = () => { },
31-
setSearchValue = () => { }, onSubmit = () => {},
32+
setSearchValue = () => { }, onSubmit = () => {}, setShowHidden = () => { },
3233
}) => (
3334
<SearchArea
3435
searchValue={searchValue}
@@ -45,6 +46,7 @@ const SearchAreaWrapper = ({
4546
setJobType={setJobType}
4647
setSearchValue={setSearchValue}
4748
onSubmit={onSubmit}
49+
setShowHidden={setShowHidden}
4850
/>
4951
);
5052

@@ -63,6 +65,7 @@ SearchAreaWrapper.propTypes = {
6365
setShowJobDurationSlider: PropTypes.func.isRequired,
6466
jobDuration: PropTypes.number,
6567
filterJobDuration: PropTypes.bool,
68+
setShowHidden: PropTypes.bool,
6669
};
6770

6871
describe("SearchArea", () => {
@@ -321,6 +324,10 @@ describe("SearchArea", () => {
321324
props.setShowJobDurationSlider(filterJobDuration);
322325
expect(dispatch).toHaveBeenCalledWith(setShowJobDurationSlider(false));
323326

327+
const showHidden = true;
328+
props.setShowHidden(showHidden);
329+
expect(dispatch).toHaveBeenCalledWith(setShowHidden(true));
330+
324331
dispatch.mockClear();
325332
props.resetAdvancedSearchFields();
326333
expect(dispatch).toHaveBeenCalled();

0 commit comments

Comments
 (0)