From 2c467919edaee41773a6d108df5ebdfe4bb713a0 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 16 Mar 2018 15:47:01 +0200 Subject: [PATCH] test(cp) always rm tmp dir --- test/rest/cp.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/rest/cp.js b/test/rest/cp.js index 4de85476..21948ecc 100644 --- a/test/rest/cp.js +++ b/test/rest/cp.js @@ -3,7 +3,6 @@ const { join, } = require('path'); -const fs = require('fs'); const test = require('tape'); const {promisify} = require('es6-promisify'); const pullout = require('pullout'); @@ -36,17 +35,18 @@ test('cloudcmd: rest: cp', (t) => { mkdirp.sync(tmp); + const rmTmp = () => rimraf.sync(tmp); + put(`http://localhost:${port}/api/v1/cp`, files) .then(warp(_pullout, 'string')) .then((body) => { t.equal(body, 'copy: ok("["cp.txt"]")', 'should return result'); t.end(); - rimraf.sync(tmp); - after(); }) - .catch(console.error); + .catch(console.error) + .then(rmTmp); }); });