diff --git a/src/ui/LightDarkImg/LightDarkImg.test.tsx b/src/ui/LightDarkImg/LightDarkImg.test.tsx index bc3665cbfe..5b8b534a86 100644 --- a/src/ui/LightDarkImg/LightDarkImg.test.tsx +++ b/src/ui/LightDarkImg/LightDarkImg.test.tsx @@ -14,6 +14,16 @@ const renderWithTheme = (ui: React.ReactElement, theme: Theme) => { ) } +const wrapper = (theme: Theme) => { + return ({ children }: { children: React.ReactNode }) => { + return ( + + {children} + + ) + } +} + describe('LightDarkImg', () => { const mockProps = { src: '/light-image.png', @@ -22,7 +32,7 @@ describe('LightDarkImg', () => { } it('renders with light source in light mode', () => { - renderWithTheme(, Theme.LIGHT) + render(, { wrapper: wrapper(Theme.LIGHT) }) const img = screen.getByAltText('Test image') expect(img).toBeInTheDocument() @@ -43,7 +53,9 @@ describe('LightDarkImg', () => { alt: 'Test image', } - renderWithTheme(, Theme.DARK) + render(, { + wrapper: wrapper(Theme.DARK), + }) const img = screen.getByAltText('Test image') expect(img).toBeInTheDocument() @@ -51,18 +63,13 @@ describe('LightDarkImg', () => { }) it('passes through additional props to img element', () => { - renderWithTheme( - , - Theme.LIGHT + render( + , + { wrapper: wrapper(Theme.LIGHT) } ) const img = screen.getByAltText('Test image') - expect(img).toHaveClass('test-class') + expect(img).toHaveClass('w-10') expect(img).toHaveAttribute('data-testid', 'test-img') }) })