Skip to content

Commit

Permalink
test: Add test for the agnostic adapter (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 authored Jan 28, 2025
1 parent 23c57cb commit d0c18e1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
16 changes: 16 additions & 0 deletions packages/e2e/next/cypress/e2e/shared/basic-io.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ testBasicIO({
path: '/pages/basic-io/useQueryStates',
nextJsRouter: 'pages'
})

// Test the agnostic adapter

testBasicIO({
hook: 'useQueryState',
path: '/app/agnostic/basic-io',
nextJsRouter: 'app',
description: 'Agnostic adapter'
})

testBasicIO({
hook: 'useQueryState',
path: '/pages/agnostic/basic-io',
nextJsRouter: 'pages',
description: 'Agnostic adapter'
})
10 changes: 10 additions & 0 deletions packages/e2e/next/src/app/app/agnostic/basic-io/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { UseQueryStateBasicIO } from 'e2e-shared/specs/basic-io'
import { Suspense } from 'react'

export default function Page() {
return (
<Suspense>
<UseQueryStateBasicIO />
</Suspense>
)
}
10 changes: 10 additions & 0 deletions packages/e2e/next/src/app/app/agnostic/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NuqsAdapter } from 'nuqs/adapters/next'
import type { ReactNode } from 'react'

export default function RouterAgnosticLayout({
children
}: {
children: ReactNode
}) {
return <NuqsAdapter>{children}</NuqsAdapter>
}
10 changes: 10 additions & 0 deletions packages/e2e/next/src/pages/pages/agnostic/basic-io.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { UseQueryStateBasicIO } from 'e2e-shared/specs/basic-io'
import { NuqsAdapter } from 'nuqs/adapters/next'

export default function Page() {
return (
<NuqsAdapter>
<UseQueryStateBasicIO />
</NuqsAdapter>
)
}
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependsOn": ["^build"]
},
"nuqs#build": {
"outputs": ["dist/**", "size.json", ".tsup"]
"outputs": ["dist/**", "size.json", ".tsup/**", ".tsbuildinfo"]
},
"e2e-next#build": {
"outputs": [".next/**", "!.next/cache/**", "cypress/**"],
Expand Down

0 comments on commit d0c18e1

Please sign in to comment.