Thanks, @nam-m.
Most people don't recommend Unit Testing (UT) for the main layout. However, rendering is necessary for testing {children}. I couldn't find a better solution, so we can either ignore the warning or remove UT for the layout.
Thanks, @nam-m. Most people don't recommend Unit Testing (UT) for the main layout. However, rendering is necessary for testing {children}. I couldn't find a better solution, so we can either ignore the warning or remove UT for the layout.
Maybe we don't need unit test for the layout then. Since Next.js builds the page using html and body automatically, we can presume this will always work
Thanks, @nam-m. Most people don't recommend Unit Testing (UT) for the main layout. However, rendering is necessary for testing {children}. I couldn't find a better solution, so we can either ignore the warning or remove UT for the layout.
Maybe we don't need unit test for the layout then. Since Next.js builds the page using html and body automatically, we can presume this will always work
I got a warning in terminal, couldn't able to solve it console.error Warning: validateDOMNesting(...): cannot appear as a child of
It's because RootLayout contains html tag, which is the whole page. You probably won't need to test
render
the whole pageI found this https://www.reddit.com/r/nextjs/comments/17ysp6r/how_to_write_a_test_for_the_main_layout_file/
Thanks, @nam-m. Most people don't recommend Unit Testing (UT) for the main layout. However, rendering is necessary for testing {children}. I couldn't find a better solution, so we can either ignore the warning or remove UT for the layout.
Maybe we don't need unit test for the layout then. Since Next.js builds the page using
html
andbody
automatically, we can presume this will always workThis makes sense to me.