-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing tests and missing tags from HTML file
- Loading branch information
Showing
4 changed files
with
68 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { create, act } from 'react-test-renderer'; | ||
import { describe, test } from '@jest/globals'; | ||
import axios from 'axios'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import CoachDaveSponsor from '../CoachDaveSponsor'; | ||
|
||
jest.mock('react-i18next'); | ||
jest.mock('axios'); | ||
|
||
describe('components/CoachDaveSponsor', () => { | ||
test('renders', async () => { | ||
let component; | ||
|
||
act(() => { | ||
component = create(<CoachDaveSponsor />); | ||
}); | ||
|
||
expect(component.toJSON()).toMatchSnapshot(); | ||
|
||
await act(async () => { | ||
await component.root.findByType('a').props.onClick(); | ||
}); | ||
|
||
expect(window.dataLayer.push).toHaveBeenCalledWith(expect.objectContaining({ event: 'select_content' })); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
src/components/__tests__/__snapshots__/CoachDaveSponsor.test.js.snap
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,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`components/CoachDaveSponsor renders 1`] = ` | ||
<div | ||
className="sponsoredContainer" | ||
> | ||
<a | ||
className="sponsoredLink" | ||
href="https://coachdaveacademy.com/product/iracing-setup-subscription/?ref=weekly_planner" | ||
onClick={[Function]} | ||
rel="sponsored" | ||
> | ||
<h4 | ||
className="sponsoredHeader" | ||
> | ||
Sponsored | ||
</h4> | ||
<h3 | ||
className="sponsoredTitle" | ||
> | ||
Looking for iRacing Setups? | ||
</h3> | ||
<p | ||
className="sponsoredBody" | ||
> | ||
Grab a setup from Coach Dave Academy, developed by professional sim racers and engineers. | ||
</p> | ||
<p | ||
className="btn btn-primary button" | ||
> | ||
Browse Setups | ||
</p> | ||
</a> | ||
</div> | ||
`; |
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