Files
cloudron-box/src/test/settings-test.js
T

64 lines
2.0 KiB
JavaScript
Raw Normal View History

/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
2021-08-20 08:58:00 -07:00
const common = require('./common.js'),
expect = require('expect.js'),
2019-07-26 10:49:29 -07:00
settings = require('../settings.js');
2018-01-23 15:47:41 -08:00
describe('Settings', function () {
2021-08-20 08:58:00 -07:00
const { setup, cleanup } = common;
before(setup);
after(cleanup);
2021-08-20 08:58:00 -07:00
it('can get default timezone', async function () {
const tz = await settings.getTimeZone();
expect(tz.length).to.not.be(0);
});
2015-07-23 12:42:52 +02:00
2021-08-20 08:58:00 -07:00
it('can get default autoupdate_pattern', async function () {
const pattern = await settings.getAutoupdatePattern();
expect(pattern).to.be('00 00 1,3,5,23 * * *');
});
2021-08-20 08:58:00 -07:00
it ('can get default cloudron name', async function () {
const name = await settings.getCloudronName();
expect(name).to.be('Cloudron');
});
2015-07-23 12:42:52 +02:00
2021-08-20 08:58:00 -07:00
it('can get default cloudron avatar', async function () {
const avatar = await settings.getCloudronAvatar();
expect(avatar).to.be.a(Buffer);
});
2015-07-23 12:42:52 +02:00
2021-08-20 08:58:00 -07:00
it('can get backup config', async function () {
const backupConfig = await settings.getBackupConfig();
expect(backupConfig.provider).to.be('filesystem');
expect(backupConfig.backupFolder).to.be('/var/backups');
});
2016-01-23 05:07:12 -08:00
2021-08-20 08:58:00 -07:00
it('can get default unstable apps setting', async function () {
const enabled = await settings.getUnstableAppsConfig();
expect(enabled).to.be(true);
});
2021-08-20 08:58:00 -07:00
it('can set unstable apps setting', async function () {
await settings.setUnstableAppsConfig(false);
2021-08-20 08:58:00 -07:00
const enabled = await settings.getUnstableAppsConfig();
expect(enabled).to.be(false);
});
2021-08-20 08:58:00 -07:00
it('can get all values', async function () {
const allSettings = await settings.list();
expect(allSettings[settings.TIME_ZONE_KEY]).to.be.a('string');
expect(allSettings[settings.AUTOUPDATE_PATTERN_KEY]).to.be.a('string');
expect(allSettings[settings.CLOUDRON_NAME_KEY]).to.be.a('string');
expect(allSettings[settings.UNSTABLE_APPS_KEY]).to.be.a('boolean');
2015-10-26 00:44:54 -07:00
});
});