From f8509f8b171a792d994954f0f52a6e0d5d3ab819 Mon Sep 17 00:00:00 2001 From: Kylart Date: Sat, 18 Nov 2017 13:14:43 +0100 Subject: [PATCH] freakin test --- test/server.test.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/test/server.test.js b/test/server.test.js index 111f70f..5506bd2 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -128,19 +128,24 @@ test('/getLatest.json exits and returns 18 elements with right keys at 720p', as test('/download Mahou Shoujo Ikusei Keikaku with HorribleSubs at 720p on nyaa.pantsu.cat exits and returns' + ' all magnets', async t => { - const { data, status } = await axios.post(`${uri}/download`, { - name: 'Mahou Shoujo Ikusei Keikaku', - quality: '720p', - fromEp: 0, - untilEp: 20000, - fansub: 'HorribleSubs', - choice: 'pantsu' - }) + try { + const { data, status } = await axios.post(`${uri}/download`, { + name: 'Mahou Shoujo Ikusei Keikaku', + quality: '720p', + fromEp: 0, + untilEp: 20000, + fansub: 'HorribleSubs', + choice: 'pantsu' + }) - if (status === 200) { - t.is(data.magnets.length, 12) - t.not(data.magnets[0], '') - } else { + if (status === 200) { + t.is(data.magnets.length, 12) + t.not(data.magnets[0], '') + } else { + t.is(status, 204) + } + } catch (e) { + console.info(e) t.fail() } })