Merge pull request #2132 from Gomah/dev

tests: make sure the files generated with the subFolders option exist
This commit is contained in:
Sébastien Chopin 2017-11-17 02:27:38 +01:00 committed by GitHub
commit 68680ee65a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import test from 'ava' import test from 'ava'
import { resolve } from 'path' import { resolve } from 'path'
import { existsSync } from 'fs'
import http from 'http' import http from 'http'
import serveStatic from 'serve-static' import serveStatic from 'serve-static'
import finalhandler from 'finalhandler' import finalhandler from 'finalhandler'
@ -78,6 +79,8 @@ test('/async-data', async t => {
test('/users/1', async t => { test('/users/1', async t => {
const html = await rp(url('/users/1')) const html = await rp(url('/users/1'))
t.true(html.includes('<h1>User: 1</h1>')) t.true(html.includes('<h1>User: 1</h1>'))
t.true(existsSync(resolve(__dirname, 'fixtures/basic/dist', 'users/1.html')))
t.false(existsSync(resolve(__dirname, 'fixtures/basic/dist', 'users/1/index.html')))
}) })
test('/users/2', async t => { test('/users/2', async t => {

View File

@ -1,5 +1,6 @@
import test from 'ava' import test from 'ava'
import { resolve } from 'path' import { resolve } from 'path'
import { existsSync } from 'fs'
import http from 'http' import http from 'http'
import serveStatic from 'serve-static' import serveStatic from 'serve-static'
import finalhandler from 'finalhandler' import finalhandler from 'finalhandler'
@ -75,6 +76,8 @@ test('/async-data', async t => {
test('/users/1', async t => { test('/users/1', async t => {
const html = await rp(url('/users/1')) const html = await rp(url('/users/1'))
t.true(html.includes('<h1>User: 1</h1>')) t.true(html.includes('<h1>User: 1</h1>'))
t.true(existsSync(resolve(__dirname, 'fixtures/basic/dist', 'users/1/index.html')))
t.false(existsSync(resolve(__dirname, 'fixtures/basic/dist', 'users/1.html')))
}) })
test('/users/2', async t => { test('/users/2', async t => {