From e19cd6a919521601a6481598b237c7febfe11ee7 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Fri, 8 Mar 2019 13:54:28 +0800 Subject: [PATCH] Modified export/import regression test so it doesn't leave leftover files --- core/test/regression/api/v2/admin/db_spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/test/regression/api/v2/admin/db_spec.js b/core/test/regression/api/v2/admin/db_spec.js index 738212fd82..8c90cdd8a9 100644 --- a/core/test/regression/api/v2/admin/db_spec.js +++ b/core/test/regression/api/v2/admin/db_spec.js @@ -68,6 +68,9 @@ describe('DB API', () => { }); it('can export & import', () => { + const exportFolder = path.join(os.tmpdir(), uuid.v1()); + const exportPath = path.join(exportFolder, 'export.json'); + return request.put(localUtils.API.getApiQuery('settings/')) .set('Origin', config.get('url')) .send({ @@ -91,8 +94,6 @@ describe('DB API', () => { const jsonResponse = res.body; should.exist(jsonResponse.db); - const exportFolder = path.join(os.tmpdir(), uuid.v1()); - const exportPath = path.join(exportFolder, 'export.json'); fs.ensureDirSync(exportFolder); fs.writeJSONSync(exportPath, jsonResponse); @@ -105,6 +106,7 @@ describe('DB API', () => { }) .then((res) => { res.body.problems.length.should.eql(3); + fs.removeSync(exportFolder); }); });