tests: make sure the files generated with the subFolders option exist

This commit is contained in:
Gomah 2017-11-17 11:27:30 +11:00
parent 682169625f
commit 5c69e0e288
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 => {