Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 25, 2022
1 parent 096c17d commit 60f95c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 6 additions & 4 deletions test/e2e/app-dir/head.test.ts
Expand Up @@ -42,16 +42,18 @@ describe('app dir head', () => {
).toBeTruthy()
})

it('should not use head from layout when on page', async () => {
it('should use correct head for /blog', async () => {
const html = await renderViaHTTP(next.url, '/blog')
const $ = cheerio.load(html)
const headTags = $('head').children().toArray()

expect(headTags.find((el) => el.attribs.src === '/hello3.js')).toBeFalsy()
expect(
headTags.find((el) => el.attribs.src === '/hello3.js')
headTags.find((el) => el.attribs.src === '/hello1.js')
).toBeTruthy()
expect(
headTags.find((el) => el.attribs.src === '/hello2.js')
).toBeTruthy()
expect(headTags.find((el) => el.attribs.src === '/hello1.js')).toBeFalsy()
expect(headTags.find((el) => el.attribs.src === '/hello2.js')).toBeFalsy()
expect(
headTags.find((el) => el.attribs.src === '/another.js')
).toBeTruthy()
Expand Down
9 changes: 0 additions & 9 deletions test/e2e/app-dir/head/app/blog/page.js
Expand Up @@ -11,12 +11,3 @@ export default function Page() {
</>
)
}

export async function Head() {
return (
<>
<script async src="/hello3.js" />
<title>hello from blog page</title>
</>
)
}

0 comments on commit 60f95c2

Please sign in to comment.