From b61a4da50c192924426ed3620cea91f51952901f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 7 Aug 2020 20:20:02 -0400 Subject: [PATCH] feat: #8550, add upgrade script test flush test db after tests are complete --- test/mocks/databasemock.js | 4 ++++ test/upgrade.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/upgrade.js diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js index d70ed705d1..158f105a66 100644 --- a/test/mocks/databasemock.js +++ b/test/mocks/databasemock.js @@ -105,6 +105,10 @@ winston.info('environment ' + global.env); const db = require('../../src/database'); module.exports = db; +after(async function () { + await db.flushdb(); +}); + before(async function () { this.timeout(30000); await db.init(); diff --git a/test/upgrade.js b/test/upgrade.js new file mode 100644 index 0000000000..9f4e5dc364 --- /dev/null +++ b/test/upgrade.js @@ -0,0 +1,13 @@ +'use strict'; + +const assert = require('assert'); + +const db = require('./mocks/databasemock'); +const upgrade = require('../src/upgrade'); + +describe('Upgrade', function () { + it('should get all upgrade scripts', async function () { + const files = await upgrade.getAll(); + assert(Array.isArray(files) && files.length > 0); + }); +});