Skip to content

Commit

Permalink
add react version test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Apr 27, 2023
1 parent 64c2b70 commit 1ff72bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions test/e2e/app-dir/app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ createNextDescribe(
expect($('title').first().text()).toBe('hello world')
})

it('should serve from pages', async () => {
const html = await next.render('/')
expect(html).toContain('hello from pages/index')
it('should serve from pages with latest react', async () => {
const $ = await next.render$('/')
expect($('#hello').text()).toBe('hello from pages/index')
expect($('#react-version').text()).toBe('18.2.0')
})

it('should serve dynamic route from pages', async () => {
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/app-dir/app/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import styles from '../styles/shared.module.css'
export default function Page() {
return (
<>
<p className={styles.content}>hello from pages/index</p>
<p id="hello" className={styles.content}>
hello from pages/index
</p>
<Link href="/dashboard">Dashboard</Link>
<p id="react-version">{React.version}</p>
</>
)
}

0 comments on commit 1ff72bd

Please sign in to comment.