import test from 'ava' import { join } from 'path' import build from '../server/build' import { render as _render } from '../server/render' const dir = join(__dirname, 'fixtures', 'basic') test.before(() => build(dir)) test('renders a stateless component', async t => { const html = await render('/stateless') t.true(html.includes('')) t.true(html.includes('

My component!

')) }) test('renders a stateful component', async t => { const html = await render('/stateful') t.true(html.includes('

The answer is 42

')) }) test('header helper renders header information', async t => { const html = await (render('/head')) t.true(html.includes('')) t.true(html.includes('')) t.true(html.includes('

I can haz meta tags

')) }) test('css helper renders styles', async t => { const html = await render('/css') t.regex(html, /\.css-\w+/) t.regex(html, /
This is red<\/div>/) }) test('renders properties populated asynchronously', async t => { const html = await render('/async-props') t.true(html.includes('

Diego Milito

')) }) test('renders a link component', async t => { const html = await render('/link') t.true(html.includes('About')) }) function render (url, ctx) { return _render(url, ctx, { dir, staticMarkup: true }) }