basic layout test
This commit is contained in:
parent
d1e417b9d7
commit
64b835a59a
|
@ -0,0 +1,24 @@
|
|||
import { render, screen } from '@testing-library/react'
|
||||
import { dataLocation } from '../../../tests/__fixtures__/location'
|
||||
import Layout from '../layout'
|
||||
|
||||
describe('app: /layout', () => {
|
||||
// suppress error "Warning: validateDOMNesting(...): <html> cannot appear as a child of <div>"
|
||||
// https://github.com/testing-library/react-testing-library/issues/1250
|
||||
let originalError
|
||||
|
||||
beforeAll(() => {
|
||||
originalError = console.error
|
||||
console.error = jest.fn()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
console.error = originalError
|
||||
})
|
||||
|
||||
it('renders correctly', async () => {
|
||||
render(<Layout>Hello</Layout>)
|
||||
|
||||
await screen.findByText(dataLocation.now.city)
|
||||
})
|
||||
})
|
|
@ -1,3 +1,4 @@
|
|||
import { ReactNode } from 'react'
|
||||
import { Metadata, Viewport } from 'next'
|
||||
import Script from 'next/script'
|
||||
import meta from '../../_content/meta.json'
|
||||
|
@ -35,11 +36,7 @@ export const viewport: Viewport = {
|
|||
themeColor: 'var(--theme-color)'
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<head>
|
||||
|
|
|
@ -11,7 +11,6 @@ import { UseLocation } from './types'
|
|||
|
||||
export default function Location() {
|
||||
const shouldReduceMotion = useReducedMotion()
|
||||
|
||||
const [location, setLocation] = useState<UseLocation>()
|
||||
|
||||
const isDifferentCountry = location?.now?.country !== location?.next?.country
|
||||
|
|
Loading…
Reference in New Issue