mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
add a test
This commit is contained in:
parent
4f21383e0f
commit
3647ed14ac
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
*.log
|
||||
node_modules
|
||||
dist
|
||||
.next
|
||||
|
|
3
test/fixtures/basic/pages/stateless.js
vendored
Normal file
3
test/fixtures/basic/pages/stateless.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import React from 'react'
|
||||
|
||||
export default () => <h1>My component!</h1>
|
18
test/index.js
Normal file
18
test/index.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import test from 'ava'
|
||||
import { resolve } from 'path'
|
||||
import build from '../server/build'
|
||||
import { render as _render } from '../server/render'
|
||||
|
||||
const dir = resolve(__dirname, 'fixtures', 'basic')
|
||||
|
||||
test.before(() => build(dir))
|
||||
|
||||
test(async (t) => {
|
||||
const html = await render('/stateless')
|
||||
console.log(html)
|
||||
t.true(html.includes('<h1>My component!</h1>'))
|
||||
})
|
||||
|
||||
function render (url, ctx) {
|
||||
return _render(url, ctx, { dir, staticMarkup: true })
|
||||
}
|
Loading…
Reference in a new issue