Skip to content

Commit

Permalink
Improve search area coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
DoStini committed Jan 24, 2023
1 parent 496dfab commit 052b4b3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/components/HomePage/SearchArea/SearchArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const AdvancedSearchController = ({
enableAdvancedSearchDefault, showJobDurationSlider, setShowJobDurationSlider, jobMinDuration,
jobMaxDuration, setJobDuration, jobType, setJobType, fields, setFields, technologies, setTechs,
resetAdvancedSearchFields, onSubmit, searchValue, setSearchValue, onMobileClose,
// eslint-disable-next-line no-unused-vars
loadUrlFromFilters, setLoadUrlFromFilters,
}) => {

Expand Down
35 changes: 35 additions & 0 deletions src/components/HomePage/SearchArea/SearchArea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,41 @@ describe("SearchArea", () => {
expect(onSubmit).toHaveBeenCalledTimes(1);
});

it("should call onSubmit callback on search button click", () => {
const searchValue = "test";
const setSearchValue = () => { };

const onSubmit = jest.fn();
const addSnackbar = () => { };

// Simulate request success
fetch.mockResponse(JSON.stringify({ mockData: true }));

renderWithStoreAndTheme(
<RouteWrappedContent>
<SearchArea
searchValue={searchValue}
setSearchValue={setSearchValue}
addSnackbar={addSnackbar}
loadUrlFromFilters={true}
showJobDurationSlider={() => { }}
setShowJobDurationSlider={() => { }}
setTechs={() => { }}
setJobDuration={() => { }}
setFields={() => { }}
setJobType={() => { }}
onSubmit={onSubmit}
fields={[]}
technologies={[]}
setLoadUrlFromFilters={() => { }}
/>
</RouteWrappedContent>,
{ initialState, theme }
);

expect(onSubmit).toHaveBeenCalledTimes(1);
});

it("should fill in search filters if they are present in the URL", () => {

const urlParams = {
Expand Down

0 comments on commit 052b4b3

Please sign in to comment.