Skip to content

Commit

Permalink
test: adds more showHidden tests
Browse files Browse the repository at this point in the history
Co-authored-by: Diogo Fonte diogo.fonte2000@gmail.com
  • Loading branch information
CarlosMealha committed Feb 12, 2023
1 parent bcb8ca8 commit 6e15449
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/actions/searchOffersActions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("Search Offers actions", () => {

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

const showHidden = "show_hidden";
const showHidden = true;
const expectedAction = {
type: OfferSearchTypes.SET_SHOW_HIDDEN,
showHidden,
Expand Down
9 changes: 8 additions & 1 deletion src/components/HomePage/SearchArea/SearchArea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
setFields,
setTechs,
setShowJobDurationSlider,
setShowHidden,
} from "../../../actions/searchOffersActions";
import { createTheme } from "@material-ui/core";
import { renderWithStoreAndTheme, screen, fireEvent, act } from "../../../test-utils";
Expand All @@ -28,7 +29,7 @@ const SearchAreaWrapper = ({
searchValue = "", jobType = INITIAL_JOB_TYPE, jobDuration = [null, null], filterJobDuration = false,
showJobDurationSlider = false, fields = [], technologies = [], setShowJobDurationSlider = () => { },
setTechs = () => { }, setJobDuration = () => { }, setFields = () => { }, setJobType = () => { },
setSearchValue = () => { }, onSubmit = () => {},
setSearchValue = () => { }, onSubmit = () => {}, setShowHidden = () => { },
}) => (
<SearchArea
searchValue={searchValue}
Expand All @@ -45,6 +46,7 @@ const SearchAreaWrapper = ({
setJobType={setJobType}
setSearchValue={setSearchValue}
onSubmit={onSubmit}
setShowHidden={setShowHidden}
/>
);

Expand All @@ -63,6 +65,7 @@ SearchAreaWrapper.propTypes = {
setShowJobDurationSlider: PropTypes.func.isRequired,
jobDuration: PropTypes.number,
filterJobDuration: PropTypes.bool,
setShowHidden: PropTypes.bool,
};

describe("SearchArea", () => {
Expand Down Expand Up @@ -321,6 +324,10 @@ describe("SearchArea", () => {
props.setShowJobDurationSlider(filterJobDuration);
expect(dispatch).toHaveBeenCalledWith(setShowJobDurationSlider(false));

const showHidden = true;
props.setShowHidden(showHidden);
expect(dispatch).toHaveBeenCalledWith(setShowHidden(true));

dispatch.mockClear();
props.resetAdvancedSearchFields();
expect(dispatch).toHaveBeenCalled();
Expand Down

0 comments on commit 6e15449

Please sign in to comment.