-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1084 from GSA/978-e2e-releative-benefits-icons
978 e2e releative benefits icons
- Loading branch information
Showing
14 changed files
with
521 additions
and
4 deletions.
There are no files selected for viewing
190 changes: 190 additions & 0 deletions
190
benefit-finder/src/App/__tests__/__snapshots__/index.spec.jsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
37 changes: 35 additions & 2 deletions
37
benefit-finder/src/shared/components/RelativeBenefitList/__tests__/index.spec.jsx
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 |
---|---|---|
@@ -1,9 +1,42 @@ | ||
import { render } from '@testing-library/react' | ||
import { render, waitFor, screen } from '@testing-library/react' | ||
import RelativeBenefitList from '../index.jsx' | ||
import content from '../../../api/mock-data/current.js' | ||
|
||
const { data } = JSON.parse(content) | ||
const relativeBenefits = data.lifeEventForm.relevantBenefits | ||
const args = { | ||
data: relativeBenefits, | ||
carrotType: 'carrot-big', | ||
} | ||
|
||
describe('RelativeBenefitList', () => { | ||
it('renders a match to the previous snapshot', () => { | ||
const { asFragment } = render(<RelativeBenefitList />) | ||
const { asFragment } = render( | ||
<RelativeBenefitList data={args.data} carrotType={args.carrotType} /> | ||
) | ||
expect(asFragment()).toMatchSnapshot() | ||
}) | ||
|
||
it('renders icons based on its lifeEvent id', async () => { | ||
render( | ||
<RelativeBenefitList data={args.data} carrotType={args.carrotType} /> | ||
) | ||
|
||
// wait until the last relative benefit renders | ||
await waitFor(() => { | ||
screen.getByTestId(relativeBenefits[1].lifeEvent.lifeEventId) | ||
}) | ||
const links = screen.getAllByRole('link') | ||
|
||
// ensure the link contains values from the lifeEventId | ||
expect(links[0].href).toContain(relativeBenefits[0].lifeEvent.lifeEventId) | ||
expect(links[1].href).toContain(relativeBenefits[1].lifeEvent.lifeEventId) | ||
// ensure the icons that contain values from the lifeEventId are in the dom | ||
expect( | ||
screen.getByTestId(`icon-${relativeBenefits[0].lifeEvent.lifeEventId}`) | ||
).toBeInTheDocument() | ||
expect( | ||
screen.getByTestId(`icon-${relativeBenefits[1].lifeEvent.lifeEventId}`) | ||
).toBeInTheDocument() | ||
}) | ||
}) |
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
Oops, something went wrong.