From f7cc48495b085fe8f6cfa37e80e968d5b47639df Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 1 Jun 2022 23:21:30 +0200 Subject: test: install and configure cypress I also configure Jest to avoid conflicts between Cypress and Jest. --- src/components/organisms/widgets/image-widget.test.tsx | 2 +- src/components/organisms/widgets/links-list-widget.test.tsx | 2 +- src/components/organisms/widgets/sharing.test.tsx | 2 +- src/components/organisms/widgets/social-media.test.tsx | 2 +- src/components/organisms/widgets/table-of-contents.test.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/components/organisms/widgets') diff --git a/src/components/organisms/widgets/image-widget.test.tsx b/src/components/organisms/widgets/image-widget.test.tsx index c6b1a3a..6548584 100644 --- a/src/components/organisms/widgets/image-widget.test.tsx +++ b/src/components/organisms/widgets/image-widget.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@test-utils'; +import { render, screen } from '@tests/utils'; import ImageWidget from './image-widget'; const description = 'Ut vitae sit'; diff --git a/src/components/organisms/widgets/links-list-widget.test.tsx b/src/components/organisms/widgets/links-list-widget.test.tsx index a8d6a35..d695d68 100644 --- a/src/components/organisms/widgets/links-list-widget.test.tsx +++ b/src/components/organisms/widgets/links-list-widget.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@test-utils'; +import { render, screen } from '@tests/utils'; import LinksListWidget from './links-list-widget'; const title = 'Voluptatem minus autem'; diff --git a/src/components/organisms/widgets/sharing.test.tsx b/src/components/organisms/widgets/sharing.test.tsx index 48da49e..88f72fe 100644 --- a/src/components/organisms/widgets/sharing.test.tsx +++ b/src/components/organisms/widgets/sharing.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@test-utils'; +import { render, screen } from '@tests/utils'; import Sharing, { type SharingData } from './sharing'; const postData: SharingData = { diff --git a/src/components/organisms/widgets/social-media.test.tsx b/src/components/organisms/widgets/social-media.test.tsx index e40db30..45e4a8a 100644 --- a/src/components/organisms/widgets/social-media.test.tsx +++ b/src/components/organisms/widgets/social-media.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@test-utils'; +import { render, screen } from '@tests/utils'; import SocialMedia, { Media } from './social-media'; const media: Media[] = [ diff --git a/src/components/organisms/widgets/table-of-contents.test.tsx b/src/components/organisms/widgets/table-of-contents.test.tsx index 2064f39..92ae895 100644 --- a/src/components/organisms/widgets/table-of-contents.test.tsx +++ b/src/components/organisms/widgets/table-of-contents.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@test-utils'; +import { render, screen } from '@tests/utils'; import TableOfContents from './table-of-contents'; describe('TableOfContents', () => { -- cgit v1.2.3 From fc7a6e98268d34f313d79c817e38c09ad6cde960 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 2 Jun 2022 23:51:43 +0200 Subject: test(unit): fix Jest errors due to images import I mocked some SVG files and moves the branding photo to public directory. It is more a workaround than a real fix but it works so... --- public/armand-philippot.jpg | Bin 0 -> 24539 bytes src/assets/images/armand-philippot.jpg | Bin 24539 -> 0 bytes src/components/atoms/links/social-link.test.tsx | 3 +++ src/components/organisms/widgets/social-media.test.tsx | 2 ++ src/components/templates/layout/layout.tsx | 2 +- 5 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 public/armand-philippot.jpg delete mode 100644 src/assets/images/armand-philippot.jpg (limited to 'src/components/organisms/widgets') diff --git a/public/armand-philippot.jpg b/public/armand-philippot.jpg new file mode 100644 index 0000000..735be45 Binary files /dev/null and b/public/armand-philippot.jpg differ diff --git a/src/assets/images/armand-philippot.jpg b/src/assets/images/armand-philippot.jpg deleted file mode 100644 index 735be45..0000000 Binary files a/src/assets/images/armand-philippot.jpg and /dev/null differ diff --git a/src/components/atoms/links/social-link.test.tsx b/src/components/atoms/links/social-link.test.tsx index e13689c..b3f9a4c 100644 --- a/src/components/atoms/links/social-link.test.tsx +++ b/src/components/atoms/links/social-link.test.tsx @@ -6,6 +6,9 @@ import SocialLink from './social-link'; * the svg files manually. */ jest.mock('@assets/images/social-media/github.svg', () => 'svg-file'); +jest.mock('@assets/images/social-media/gitlab.svg', () => 'svg-file'); +jest.mock('@assets/images/social-media/linkedin.svg', () => 'svg-file'); +jest.mock('@assets/images/social-media/twitter.svg', () => 'svg-file'); describe('SocialLink', () => { it('render a social link', () => { diff --git a/src/components/organisms/widgets/social-media.test.tsx b/src/components/organisms/widgets/social-media.test.tsx index 45e4a8a..ec6c536 100644 --- a/src/components/organisms/widgets/social-media.test.tsx +++ b/src/components/organisms/widgets/social-media.test.tsx @@ -13,7 +13,9 @@ const titleLevel = 2; * the svg files manually. */ jest.mock('@assets/images/social-media/github.svg', () => 'svg-file'); +jest.mock('@assets/images/social-media/gitlab.svg', () => 'svg-file'); jest.mock('@assets/images/social-media/linkedin.svg', () => 'svg-file'); +jest.mock('@assets/images/social-media/twitter.svg', () => 'svg-file'); describe('SocialMedia', () => { it('renders the widget title', () => { diff --git a/src/components/templates/layout/layout.tsx b/src/components/templates/layout/layout.tsx index 982b099..693951e 100644 --- a/src/components/templates/layout/layout.tsx +++ b/src/components/templates/layout/layout.tsx @@ -1,4 +1,3 @@ -import photo from '@assets/images/armand-philippot.jpg'; import ButtonLink from '@components/atoms/buttons/button-link'; import Career from '@components/atoms/icons/career'; import CCBySA from '@components/atoms/icons/cc-by-sa'; @@ -18,6 +17,7 @@ import Script from 'next/script'; import { FC, ReactElement, ReactNode, useRef, useState } from 'react'; import { useIntl } from 'react-intl'; import { Person, SearchAction, WebSite, WithContext } from 'schema-dts'; +import photo from '/public/armand-philippot.jpg'; import styles from './layout.module.scss'; export type QueryAction = SearchAction & { -- cgit v1.2.3