Unverified Commit 90a4e3af authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Move test selectors as close to the actual value as possible (Part 2) (#80416)

parent c8ac2a52
export default async function Page() { export default async function Page() {
return <section>rewritten</section> return <section data-testid="content">rewritten</section>
} }
export default async function Page() { export default async function Page() {
return <section>rewritten</section> return <section data-testid="content">rewritten</section>
} }
...@@ -13,12 +13,13 @@ describe('Node Extensions', () => { ...@@ -13,12 +13,13 @@ describe('Node Extensions', () => {
} }
it('should not error when accessing middlware that use Math.random()', async () => { it('should not error when accessing middlware that use Math.random()', async () => {
let res, $ let res: Awaited<ReturnType<typeof next.fetch>>,
$: Awaited<ReturnType<typeof next.render$>>
res = await next.fetch('/rewrite') res = await next.fetch('/rewrite')
expect(res.status).toBe(200) expect(res.status).toBe(200)
$ = await next.render$('/rewrite') $ = await next.render$('/rewrite')
expect($('main section').text()).toBe('rewritten') expect($('[data-testid="content"]').text()).toBe('rewritten')
}) })
it('should not error when accessing pages that use Math.random() in App Router', async () => { it('should not error when accessing pages that use Math.random() in App Router', async () => {
...@@ -165,7 +166,7 @@ describe('Node Extensions', () => { ...@@ -165,7 +166,7 @@ describe('Node Extensions', () => {
res = await next.fetch('/rewrite') res = await next.fetch('/rewrite')
expect(res.status).toBe(200) expect(res.status).toBe(200)
$ = await next.render$('/rewrite') $ = await next.render$('/rewrite')
expect($('main section').text()).toBe('rewritten') expect($('[data-testid="content"]').text()).toBe('rewritten')
}) })
it('should not error when accessing pages that use Math.random() in App Router', async () => { it('should not error when accessing pages that use Math.random() in App Router', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment