-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add unit test for YoutubeEmbed component (#6983)
* chore: add unit test for YoutubeEmbed component * add code coverage stats --------- Co-authored-by: katiegoines <katiegoines@gmail.com>
- Loading branch information
1 parent
3647359
commit fb1b8ed
Showing
2 changed files
with
22 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
21 changes: 21 additions & 0 deletions
21
src/components/YoutubeEmbed/__tests__/YoutubeEmbed.test.tsx
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,21 @@ | ||
import * as React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { YoutubeEmbed } from '../index'; | ||
|
||
describe('YoutubeEmbed', () => { | ||
const embedId = 'uaG2mMYLI68'; | ||
const component = <YoutubeEmbed embedId={embedId} />; | ||
it('should render the YoutubeEmbed component', async () => { | ||
render(component); | ||
const iframe = await screen.getByTitle('YouTube video player'); | ||
expect(iframe).toBeInTheDocument(); | ||
}); | ||
|
||
it('should be sized to 560w by 315h', async () => { | ||
render(component); | ||
const iframe = await screen.getByTitle('YouTube video player'); | ||
expect(iframe.getAttribute('style')).toEqual( | ||
'--youtube-embed-width: 560; --youtube-embed-height: 315;' | ||
); | ||
}); | ||
}); |