Skip to content

Commit

Permalink
Reenable app-static usePathname tests (#55065)
Browse files Browse the repository at this point in the history
Re-enable `usePathname` related tests

Closes NEXT-112
  • Loading branch information
huozhi authored Sep 8, 2023
1 parent 56eeedf commit 6ffb8da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
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

0 comments on commit 6ffb8da

Please sign in to comment.