From d49ba68388d32a27248102dccbe3cb4beec8d2c3 Mon Sep 17 00:00:00 2001 From: Roy Scheeren Date: Mon, 15 Jan 2024 16:35:40 +0100 Subject: [PATCH] refactor(envited.ascs.digital): heroheader test Signed-off-by: Roy Scheeren --- .../modules/HeroHeader/HeroHeader.ui.test.tsx | 13 ++++++------- apps/envited.ascs.digital/setupTests.ts | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/envited.ascs.digital/modules/HeroHeader/HeroHeader.ui.test.tsx b/apps/envited.ascs.digital/modules/HeroHeader/HeroHeader.ui.test.tsx index a82b69ac..ba723bb7 100644 --- a/apps/envited.ascs.digital/modules/HeroHeader/HeroHeader.ui.test.tsx +++ b/apps/envited.ascs.digital/modules/HeroHeader/HeroHeader.ui.test.tsx @@ -1,8 +1,8 @@ import { useSession } from 'next-auth/react' import React from 'react' -import TestRenderer, { ReactTestRendererJSON } from 'react-test-renderer' import { HeroHeader } from './HeroHeader' +import { render } from '@testing-library/react' jest.mock('next-auth/react') @@ -26,13 +26,12 @@ describe('modules/HeroHeader', () => { describe('render', () => { it('should return as expected', async () => { // when ... rendering component - mockUseSession.mockReturnValue({}) - const component = TestRenderer.create() - // then ... should render with expected css class - const tree = component.toJSON() as ReactTestRendererJSON - - expect(tree.props.className).toContain('mx-auto') + + mockUseSession.mockReturnValue({}) + const { container } = render() + + expect(container.firstChild).toHaveClass('mx-auto max-w-6xl') }) }) }) diff --git a/apps/envited.ascs.digital/setupTests.ts b/apps/envited.ascs.digital/setupTests.ts index 54afb4d6..3f527a85 100644 --- a/apps/envited.ascs.digital/setupTests.ts +++ b/apps/envited.ascs.digital/setupTests.ts @@ -1,3 +1,5 @@ +import '@testing-library/jest-dom' + import { TextDecoder, TextEncoder } from 'util' Object.assign(global, { TextDecoder, TextEncoder })