1
0
Fork 0
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:
nkzawa 2016-10-10 13:25:08 +09:00
parent 4f21383e0f
commit 3647ed14ac
3 changed files with 22 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.log
node_modules
dist
.next

View file

@ -0,0 +1,3 @@
import React from 'react'
export default () => <h1>My component!</h1>

18
test/index.js Normal file
View 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 })
}