Open
Conversation
The useAppParams hook is added to the hooks directory. It imports the AppParams type from the '@/types' module and the useParams hook from 'react-router-dom'. This hook is used to retrieve the parameters from the URL. The useAppSearchParams hook is also added to the hooks directory. It imports the setLimit, setSearch, useAppDispatch, and useAppSelector functions from the '@/redux' module, as well as the useEffect and useSearchParams hooks from 'react' and 'react-router-dom' respectively. This hook is used to manage the search and limit parameters in the application state based on the URL search parameters. It listens for changes in the search and limit values and dispatches actions to update the state accordingly. The updated search and limit values are returned from the hook.
…lopment environment
…e management and persistence in the app
…k for better clarity and consistency
…o handle pagination and search functionality in animal API
…lity and maintainability
… function The functions `getSearchFromStorage` and `setSearchFromStorage` were removed as they were not being used in the codebase. The `getOriginalPath` function was simplified and renamed to `generateAppPath`. It now accepts an optional `AppParams` object as a parameter and generates a path based on the provided `page` and `details` values. The function uses the `generatePath` function from `react-router-dom` to generate the path.
…gination and search functionality
…the redux toolkit query
The animal.ts file was deleted as it was no longer being used in the project. This commit removes the file from the codebase to improve code cleanliness and reduce unnecessary files.
The Checkbox component is a reusable component that allows users to select or deselect an option. It takes in the following props: - `label`: a string representing the label of the checkbox - `checked`: a boolean indicating whether the checkbox is checked or not - `onChange`: a callback function that is called when the checkbox is toggled The component renders a label element with a checkbox input and a label text. The appearance of the checkbox changes based on its checked state. When the checkbox is clicked, the `onChange` callback is called with the updated checked state.
…ct and Detailed view modes
… more flexible rendering of animal cards
…e application The Status enum is added to represent different statuses in the application. It includes the following values: Idle, Pending, Fulfilled, and Rejected. This enum will be used to track the status of various operations in the application.
…low disabling the search button
The Checkbox component was missing unit tests. This commit adds unit tests for the Checkbox component to ensure that it renders correctly with the default state and handles checkbox change correctly.
…o string to match actual behavior
This commit adds tests for the MainPage component. The tests cover the following scenarios: 1. Renders empty CardList component: - Mocks the useAppParams and useOutletContext hooks to return the necessary values. - Renders the MainPage component wrapped in a MemoryRouter. - Asserts that the listbox element and the "Not found." text are present. 2. Renders the CardList component and calls navigate on card click: - Mocks the useAppParams and useOutletContext hooks to return the necessary values. - Renders the MainPage component wrapped in a MemoryRouter. - Asserts that the card element is present. - Simulates a click event on the card element. - Asserts that the navigate function is called with the correct pathname. 3. Calls navigate on CardList wrapper click: - Mocks the useAppParams and useOutletContext hooks to return the necessary values. - Renders the MainPage component wrapped in a MemoryRouter. - Asserts that the wrapper element is present. - Simulates a click event on the wrapper element. - Asserts that the navigate function is called with the correct pathname and relative options.
- Add unit tests to ensure that the DetailsLayout component renders without crashing. - Add unit tests to ensure that the close button click event is handled correctly.
…vigation functionality
…d remove unused imports and variables
…s from being logged during test execution
✅ Deploy Preview for emelyanovsi-redux ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…tional boolean parameter
…cking HTTP requests in tests
- Import necessary modules and libraries for testing - Add cleanup function to clean up after each test - Add beforeAll function to start the mock server and handle unhandled requests as errors - Add afterEach function to reset the mock server handlers and reset the API state in the Redux store - Add afterAll function to close the mock server after all tests are done
- Added a new file `handlers.ts` to define mock handlers for animal API requests. - Created a mock page object and a mock animal object to use in the response. - Defined a mock response object `mockRes` with the mock page, animal, and sort data. - Exported an array of mock handlers in `handlers.ts` to be used by the mock server. - Added a new file `index.ts` to export the mock server and handlers. - Created a new file `server.ts` to set up the mock server using `msw/node` and the exported mock handlers.
…nsure correct behavior
…n is dispatched when Checkbox is clicked
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.