Skip to content

Node.js based forum software built for the modern web

feat: #8550, add upgrade script test

Barış Soner Uşaklıb61a4da50c19
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);
+ });
+});