settings: move branding settings into branding.js

This commit is contained in:
Girish Ramakrishnan
2023-08-02 21:01:11 +05:30
parent 85a73af303
commit e0d07c3c19
11 changed files with 104 additions and 127 deletions

View File

@@ -7,7 +7,6 @@
const branding = require('../branding.js'),
common = require('./common.js'),
constants = require('../constants.js'),
expect = require('expect.js');
describe('Branding', function () {
@@ -16,15 +15,27 @@ describe('Branding', function () {
before(setup);
after(cleanup);
it ('can get default cloudron name', async function () {
const name = await branding.getCloudronName();
expect(name).to.be('Cloudron');
});
it('can get default cloudron avatar', async function () {
const avatar = await branding.getCloudronAvatar();
expect(avatar).to.be.a(Buffer);
});
it('can render default footer', async function () {
expect(branding.renderFooter(constants.FOOTER)).to.contain('(https://cloudron.io)');
expect(await branding.renderFooter()).to.contain('(https://cloudron.io)');
});
it('can render footer', async function () {
expect(branding.renderFooter('BigFoot Inc')).to.be('BigFoot Inc');
await branding.setFooter('BigFoot Inc');
expect(await branding.renderFooter()).to.be('BigFoot Inc');
});
it('can render footer with YEAR', async function () {
expect(branding.renderFooter('BigFoot Inc %YEAR%')).to.be('BigFoot Inc 2023');
await branding.setFooter('BigFoot Inc %YEAR%');
expect(await branding.renderFooter()).to.be('BigFoot Inc 2023');
});
});

View File

@@ -28,16 +28,6 @@ describe('Settings', function () {
expect(pattern).to.be('00 00 1,3,5,23 * * *');
});
it ('can get default cloudron name', async function () {
const name = await settings.getCloudronName();
expect(name).to.be('Cloudron');
});
it('can get default cloudron avatar', async function () {
const avatar = await settings.getCloudronAvatar();
expect(avatar).to.be.a(Buffer);
});
it('can get backup config', async function () {
const backupConfig = await settings.getBackupConfig();
expect(backupConfig.provider).to.be('filesystem');
@@ -104,7 +94,6 @@ describe('Settings', 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.IPV6_CONFIG_KEY]).to.be.an('object');
});
});