From 64f96ca0396745b09715b7845f21c166ddf54010 Mon Sep 17 00:00:00 2001 From: Jerry Edebua Date: Wed, 25 Mar 2020 15:49:41 +0300 Subject: [PATCH] Set init scripts collection to "globalconfigs" --- init-script/scripts/end.js | 2 +- init-script/scripts/start.js | 2 +- init-script/tests/db.test.js | 2 +- init-script/tests/end.test.js | 4 ++-- init-script/tests/start.test.js | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/init-script/scripts/end.js b/init-script/scripts/end.js index 6fbd71890e..dab1492b9e 100644 --- a/init-script/scripts/end.js +++ b/init-script/scripts/end.js @@ -2,7 +2,7 @@ const PKG_VERSION = require('../package.json').version; const { update } = require('../util/db'); async function run() { - const collection = 'GlobalConfig'; + const collection = 'globalconfigs'; const name = 'version'; await update(collection, { name }, { value: PKG_VERSION }); } diff --git a/init-script/scripts/start.js b/init-script/scripts/start.js index 6c10f18de6..33eb9c47ff 100644 --- a/init-script/scripts/start.js +++ b/init-script/scripts/start.js @@ -10,7 +10,7 @@ async function run() { } async function updateVersion() { - const collection = 'GlobalConfig'; + const collection = 'globalconfigs'; const name = 'version'; const docs = await find(collection, { name }); diff --git a/init-script/tests/db.test.js b/init-script/tests/db.test.js index 3ef0b692fb..ae3dd3fa54 100644 --- a/init-script/tests/db.test.js +++ b/init-script/tests/db.test.js @@ -1,7 +1,7 @@ /* eslint-disable no-undef */ const url = process.env['MONGO_URL'] || 'mongodb://localhost/fyipedb'; -const collection = 'GlobalConfig'; +const collection = 'globalconfigs'; const { collectionObject, diff --git a/init-script/tests/end.test.js b/init-script/tests/end.test.js index 58d5c2ca49..9b6869371f 100644 --- a/init-script/tests/end.test.js +++ b/init-script/tests/end.test.js @@ -8,11 +8,11 @@ const update = jest.spyOn(util, 'update'); const end = require('../scripts/end'); -test('Should update GlobalConfig record with name "version" to package version', async () => { +test('Should update globalconfigs record with name "version" to package version', async () => { mockDbCollection(); await end(); expect(update).toBeCalledWith( - 'GlobalConfig', + 'globalconfigs', { name: 'version' }, { value: PKG_VERSION } ); diff --git a/init-script/tests/start.test.js b/init-script/tests/start.test.js index 58dfdcc143..67e6f84146 100644 --- a/init-script/tests/start.test.js +++ b/init-script/tests/start.test.js @@ -9,16 +9,16 @@ const save = jest.spyOn(util, 'save'); const start = require('../scripts/start'); -test('Should query GlobalConfig for record with name "version"', async () => { +test('Should query globalconfigs for record with name "version"', async () => { mockDbCollection(true); await start(); - expect(find).toBeCalledWith('GlobalConfig', { name: 'version' }); + expect(find).toBeCalledWith('globalconfigs', { name: 'version' }); }); -test('Should save record to GlobalConfig if no records are found', async () => { +test('Should save record to globalconfigs if no records are found', async () => { mockDbCollection(); await start(); - expect(save).toBeCalledWith('GlobalConfig', [ + expect(save).toBeCalledWith('globalconfigs', [ { name: 'version', value: PKG_VERSION,