Commit 34d91b21 authored by Tim Neutkens's avatar Tim Neutkens

Add retry for type test because it's written async

parent 6bc2550c
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
describe('typed-links', () => { describe('typed-links', () => {
const { next, isNextStart, skipped } = nextTestSetup({ const { next, isNextStart, skipped } = nextTestSetup({
...@@ -11,15 +12,21 @@ describe('typed-links', () => { ...@@ -11,15 +12,21 @@ describe('typed-links', () => {
} }
it('should generate types for next/link', async () => { it('should generate types for next/link', async () => {
// The types get written outside of the server bootup process, so there isn't a specific guarantee that they're available when the dev server is started.
await retry(async () => {
const dts = await next.readFile('.next/types/link.d.ts') const dts = await next.readFile('.next/types/link.d.ts')
expect(dts).toContain(`declare module 'next/link'`) expect(dts).toContain(`declare module 'next/link'`)
}) })
})
it('should include handler route from app/api-test/route.ts in generated link route definitions', async () => { it('should include handler route from app/api-test/route.ts in generated link route definitions', async () => {
// The types get written outside of the server bootup process, so there isn't a specific guarantee that they're available when the dev server is started.
await retry(async () => {
const dts = await next.readFile('.next/types/link.d.ts') const dts = await next.readFile('.next/types/link.d.ts')
// Ensure the app route handler at app/api-test/route.ts ("/api-test") is present // Ensure the app route handler at app/api-test/route.ts ("/api-test") is present
expect(dts).toContain('`/api-test`') expect(dts).toContain('`/api-test`')
}) })
})
if (isNextStart) { if (isNextStart) {
it('should pass type checking with valid routes', async () => { it('should pass type checking with valid routes', async () => {
......
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