From de3ce19eb93c760374bb3ed42a893b29d0873475 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 13 Nov 2018 16:21:58 +0200 Subject: [PATCH] test(markdown) coverage --- server/markdown.spec.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/server/markdown.spec.js b/server/markdown.spec.js index 5446d502..c98846c5 100644 --- a/server/markdown.spec.js +++ b/server/markdown.spec.js @@ -76,7 +76,7 @@ test('cloudcmd: markdown: put', async (t) => { t.end(); }); -test('cloudcmd: markdown: put: error', (t) => { +test('cloudcmd: markdown: put: error', async (t) => { const md = path.join(fixtureDir, 'markdown-not-exist.md'); const name = 'hello'; @@ -85,15 +85,10 @@ test('cloudcmd: markdown: put: error', (t) => { mdStream.url = 'http://hello.world'; mdStream.method = 'PUT'; - _markdown(name, mdStream) - .then((result) => { - t.fail(`should fail but: ${result}`); - t.end(); - }) - .catch((error) => { - t.ok(error.message.includes('ENOENT: no such file or directory'), 'should emit error'); - t.end(); - }); + const [e] = await tryToCatch(_markdown, name, mdStream); + + t.ok(e.message.includes('ENOENT: no such file or directory'), 'should emit error'); + t.end(); }); test('cloudcmd: markdown: no name', async (t) => {