Set init scripts collection to "globalconfigs"

This commit is contained in:
Jerry Edebua 2020-03-25 15:49:41 +03:00
parent b99605a04e
commit 64f96ca039
5 changed files with 9 additions and 9 deletions

View File

@ -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 });
}

View File

@ -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 });

View File

@ -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,

View File

@ -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 }
);

View File

@ -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,