Skip to content

Commit

Permalink
Merge branch 'canary' into tests/match-path-behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 28, 2023
2 parents 6726d1e + b0cf241 commit c953640
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 129 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/test_react_experimental.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/test_react_next.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ export const ACTION_RESTORE = 'restore'
export const ACTION_SERVER_PATCH = 'server-patch'
export const ACTION_PREFETCH = 'prefetch'

export interface Mutable {
mpaNavigation?: boolean
previousTree?: FlightRouterState
patchedTree?: FlightRouterState
canonicalUrlOverride?: string
useExistingCache?: true
}

/**
* Refresh triggers a refresh of the full page data.
* - fetches the Flight data and fills subTreeData at the root of the cache.
Expand All @@ -16,12 +24,7 @@ export const ACTION_PREFETCH = 'prefetch'
export interface RefreshAction {
type: typeof ACTION_REFRESH
cache: CacheNode
mutable: {
previousTree?: FlightRouterState
patchedTree?: FlightRouterState
mpaNavigation?: boolean
canonicalUrlOverride?: string
}
mutable: Mutable
}

/**
Expand Down Expand Up @@ -65,13 +68,7 @@ export interface NavigateAction {
navigateType: 'push' | 'replace'
forceOptimisticNavigation: boolean
cache: CacheNode
mutable: {
mpaNavigation?: boolean
previousTree?: FlightRouterState
patchedTree?: FlightRouterState
canonicalUrlOverride?: string
useExistingCache?: true
}
mutable: Mutable
}

/**
Expand All @@ -98,11 +95,7 @@ export interface ServerPatchAction {
previousTree: FlightRouterState
overrideCanonicalUrl: URL | undefined
cache: CacheNode
mutable: {
patchedTree?: FlightRouterState
mpaNavigation?: boolean
canonicalUrlOverride?: string
}
mutable: Mutable
}

/**
Expand Down
30 changes: 21 additions & 9 deletions test/integration/api-support/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,24 @@ function runTests(dev = false) {

it('should show friendly error for invalid redirect', async () => {
await fetchViaHTTP(appPort, '/api/redirect-error', null, {})
expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`
)

await check(() => {
expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`
)
return 'yes'
}, 'yes')
})

it('should show friendly error in case of passing null as first argument redirect', async () => {
await fetchViaHTTP(appPort, '/api/redirect-null', null, {})
expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`
)

check(() => {
expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`
)
return 'yes'
}, 'yes')
})

it('should redirect with status code 307', async () => {
Expand Down Expand Up @@ -547,10 +555,14 @@ function runTests(dev = false) {
it('should show false positive warning if not using externalResolver flag', async () => {
const apiURL = '/api/external-resolver-false-positive'
const req = await fetchViaHTTP(appPort, apiURL)
expect(stderr).toContain(
`API resolved without sending a response for ${apiURL}, this may result in stalled requests.`
)
expect(await req.text()).toBe('hello world')

check(() => {
expect(stderr).toContain(
`API resolved without sending a response for ${apiURL}, this may result in stalled requests.`
)
return 'yes'
}, 'yes')
})

it('should not show warning if using externalResolver flag', async () => {
Expand Down

0 comments on commit c953640

Please sign in to comment.