Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable app-static usePathname tests #55065

Merged
merged 5 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions test/e2e/app-dir/app-static/app-static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@ createNextDescribe(
)
const html = await res.text()

// Shouild not bail out to client rendering
// Should not bail out to client rendering
expect(html).not.toInclude('<p>search params suspense</p>')

// Use empty search params instead
Expand All @@ -2277,17 +2277,11 @@ createNextDescribe(
}
})

// TODO: needs updating as usePathname should not bail
describe.skip('usePathname', () => {
if (isDev) {
it('should bail out to client rendering during SSG', async () => {
const res = await next.fetch('/hooks/use-pathname/slug')
const html = await res.text()
expect(html).toInclude('<html id="__next_error__">')
})
}

describe('usePathname', () => {
it('should have the correct values', async () => {
const $ = await next.render$('/hooks/use-pathname/slug')
expect($('#pathname').text()).toContain('/hooks/use-pathname/slug')

const browser = await next.browser('/hooks/use-pathname/slug')

expect(await browser.elementByCss('#pathname').text()).toBe(
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/app-dir/app-static/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ module.exports = {
return {
// beforeFiles: [ { source: '/assets/:path*', destination: '/:path*' } ],
afterFiles: [
{
source: '/rewritten-to-dashboard',
destination: '/dashboard',
},
{
source: '/rewritten-use-search-params',
destination: '/hooks/use-search-params',
Expand Down