From 3846dcb88d9d224e4677392ddba6694b07bb4d25 Mon Sep 17 00:00:00 2001 From: katiegoines Date: Tue, 27 Feb 2024 16:09:00 -0800 Subject: [PATCH 1/2] chore: add unit test for YoutubeEmbed component --- .../__tests__/YoutubeEmbed.test.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/components/YoutubeEmbed/__tests__/YoutubeEmbed.test.tsx diff --git a/src/components/YoutubeEmbed/__tests__/YoutubeEmbed.test.tsx b/src/components/YoutubeEmbed/__tests__/YoutubeEmbed.test.tsx new file mode 100644 index 00000000000..688cb896db1 --- /dev/null +++ b/src/components/YoutubeEmbed/__tests__/YoutubeEmbed.test.tsx @@ -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 = ; + 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;' + ); + }); +}); From 5b211f0dcc641e35e31bdc95d91019e482785ac5 Mon Sep 17 00:00:00 2001 From: katiegoines Date: Thu, 29 Feb 2024 08:28:00 -0800 Subject: [PATCH 2/2] add code coverage stats --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4922a142c58..07e1857edb8 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "scripts": { "clean": "rm -rf node_modules yarn.lock", "refresh": "yarn clean && yarn", - "test": "jest", + "test": "jest --coverage", "dev": "yarn prebuild && next dev", "spellcheck": "cspell \"src/**/*.mdx\" --no-progress", "spellcheck-diff": "git diff --name-only --cached | awk \"/src.*\\.mdx/{print}\" | npx cspell --no-must-find-files --file-list stdin",