Unverified Commit f7b9843b authored by Oleh Dutchenko's avatar Oleh Dutchenko Committed by GitHub

examples: Updates the `with-vitest` example for `server-only` usage (#58902)

parent 2c920e66
import { expect, test } from 'vitest'
import { expect, test, vi } from 'vitest'
import { render, screen } from '@testing-library/react'
import Page from './page'
// Disables a package that checks that code is only executed on the server side.
// Also, this mock can be defined in the Vitest setup file.
vi.mock('server-only', () => {
return {}
})
test('App Router: Works with Server Components', () => {
render(<Page />)
expect(
......
// import 'server-only' does not currently
// work with Vitest
import 'server-only'
export const metdata = {
export const metadata = {
title: 'App Router',
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment