Skip to content

Commit

Permalink
refactor(envited.ascs.digital): heroheader test
Browse files Browse the repository at this point in the history
Signed-off-by: Roy Scheeren <[email protected]>
  • Loading branch information
royscheeren committed Jan 15, 2024
1 parent efa30ab commit d49ba68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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')

Expand All @@ -26,13 +26,12 @@ describe('modules/HeroHeader', () => {
describe('render', () => {
it('should return as expected', async () => {
// when ... rendering component
mockUseSession.mockReturnValue({})
const component = TestRenderer.create(<HeroHeader />)

// 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(<HeroHeader />)

expect(container.firstChild).toHaveClass('mx-auto max-w-6xl')
})
})
})
2 changes: 2 additions & 0 deletions apps/envited.ascs.digital/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import '@testing-library/jest-dom'

import { TextDecoder, TextEncoder } from 'util'

Object.assign(global, { TextDecoder, TextEncoder })

0 comments on commit d49ba68

Please sign in to comment.