1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/test/integration/config/test/rendering.js
Tim Neutkens 183866a96d
Add support for rendering .css chunks (#4861)
Depends on https://github.com/zeit/next-plugins/pull/228

Failing tests are expected as `@zeit/next-css` has to be updated/released first.

This implements rendering of `.css` chunks. Effectively removing the custom document requirement when adding next-css/sass/less/stylus.
2018-07-30 15:48:02 +02:00

38 lines
1.1 KiB
JavaScript

/* global describe, test, expect */
import cheerio from 'cheerio'
export default function ({ app }, suiteName, render, fetch) {
async function get$ (path, query) {
const html = await render(path, query)
return cheerio.load(html)
}
describe(suiteName, () => {
test('renders css imports', async () => {
const $ = await get$('/webpack-css')
expect($('._46QtCORzC4BWRnIseSbG-').text() === 'Hello World')
})
test('renders non-js imports from node_modules', async () => {
const $ = await get$('/webpack-css')
expect($('._2pRSkKTPDMGLMnmsEkP__J').text() === 'Hello World')
})
test('renders server config on the server only', async () => {
const $ = await get$('/next-config')
expect($('#server-only').text() === 'mySecret')
})
test('renders public config on the server only', async () => {
const $ = await get$('/next-config')
expect($('#server-and-client').text() === '/static')
})
test('renders the build id in development mode', async () => {
const $ = await get$('/build-id')
expect($('#buildId').text() === '-')
})
})
}