-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #63 added first integration test for the filters page
- Loading branch information
Showing
4 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import {render, fireEvent, screen, queryByText, within} from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import Filter from '../filter'; | ||
|
||
describe("Options shows in display div", () => { | ||
it("When the check is clicked for an option, the key and value pair should be displayed for the user in the div container called information.", () => { | ||
const speciesList = { | ||
common_name: 'Yellow Flower' | ||
} | ||
|
||
const { getByText, getByTestId } = render(<Filter speciesList={speciesList} />); | ||
|
||
const checkBox = getByTestId('checkbox-option1-common_name'); | ||
fireEvent.click(checkBox); | ||
|
||
const informationContainer = screen.getByTestId('scroll-object1'); | ||
expect(within(informationContainer).getByText(/common_name:\s*Yellow Flower/i)).toBeInTheDocument(); | ||
}) | ||
}) | ||
|
||
// u can run the tests using this command: npm test -- --testPathPattern="filtering/__tests__" | ||
|
This file contains 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