From 942fd628833eecea9def38147e8f75b0d7f48c54 Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sat, 19 May 2018 18:43:24 -0400 Subject: [PATCH] Use async tests --- test/build.js | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/test/build.js b/test/build.js index 47c4079..d0ab2b1 100644 --- a/test/build.js +++ b/test/build.js @@ -22,40 +22,20 @@ const clean = () => { test.before(clean) test.after(clean) -test.cb('static renders', t => { - build(options) - .then(result => { - const html = fs.readFileSync(htmlFile, 'utf8') - t.snapshot(html) - t.end() - }) +test('static renders', async t => { + const res = await build(options) + const html = fs.readFileSync(htmlFile, 'utf8') + t.snapshot(html) }) -/* -test.cb('static writes', t => { - build(options) - .then(result => { - t.is(typeof result, 'object') - t.snapshot(result.html) - t.end() - }) -}) -*/ - -test.cb('static uses getInitialProps method', t => { - build(options) - .then(result => { - const html = fs.readFileSync(propsFile, 'utf8') - t.snapshot(html) - t.end() - }) +test('static uses getInitialProps method', async t => { + const res = await build(options) + const html = fs.readFileSync(propsFile, 'utf8') + t.snapshot(html) }) -test.cb('static makes a directory', t => { +test('static makes a directory', async t => { fs.remove(output) - - build(options) - .then(result => { - t.end() - }) + const res = await build(options) + t.pass() })