Theo's Typesafe CultTTC
Theo's Typesafe Cult4y ago
2 replies
Andrew

Jest on dynamic routing

Doing unit tests on Nextjs page with route of id, how do I pass in the query of id to not get the Error: Uncaught [TypeError: Cannot read property 'query' of null] error?
import Scholarship from '../pages/scholarship/[id]'

describe('Single scholarship page', () => {
  beforeEach(() => {})

  it('Renders scholarship page with the correct info', async () => {
    const { getByText, getByTestId } = render(<Scholarship />)
    // ...
Was this page helpful?