2023-08-04 10:10:08 +05:30
|
|
|
/* global it:false */
|
2026-02-14 09:53:14 +01:00
|
|
|
|
|
|
|
|
import BoxError from '../boxerror.js';
|
|
|
|
|
import * as common from './common.js';
|
|
|
|
|
import * as cloudron from '../cloudron.js';
|
|
|
|
|
import expect from 'expect.js';
|
|
|
|
|
import safe from 'safetydance';
|
|
|
|
|
|
2023-08-04 10:10:08 +05:30
|
|
|
/* global describe:false */
|
|
|
|
|
/* global before:false */
|
|
|
|
|
/* global after:false */
|
|
|
|
|
|
2025-02-05 19:11:02 +01:00
|
|
|
describe('Cloudron', function () {
|
2023-08-04 10:10:08 +05:30
|
|
|
const { setup, cleanup } = common;
|
|
|
|
|
|
|
|
|
|
before(setup);
|
|
|
|
|
after(cleanup);
|
|
|
|
|
|
|
|
|
|
describe('timezone', function () {
|
|
|
|
|
it('can get default timezone', async function () {
|
|
|
|
|
const tz = await cloudron.getTimeZone();
|
|
|
|
|
expect(tz).to.be('UTC');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('cannot set invalid timezone', async function () {
|
|
|
|
|
const [error] = await safe(cloudron.setTimeZone('OMG'));
|
|
|
|
|
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
|
|
|
|
});
|
|
|
|
|
|
2025-07-25 07:44:25 +02:00
|
|
|
it('can set valid timezone', async function () {
|
2023-08-04 10:10:08 +05:30
|
|
|
await cloudron.setTimeZone('Africa/Johannesburg');
|
|
|
|
|
const tz = await cloudron.getTimeZone();
|
|
|
|
|
expect(tz).to.be('Africa/Johannesburg');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('language', function () {
|
|
|
|
|
it('can get default language', async function () {
|
|
|
|
|
const lang = await cloudron.getLanguage();
|
|
|
|
|
expect(lang).to.be('en');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('cannot set invalid language', async function () {
|
|
|
|
|
const [error] = await safe(cloudron.setLanguage('ta'));
|
|
|
|
|
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('cannot set valid language', async function () {
|
|
|
|
|
await cloudron.setLanguage('de');
|
|
|
|
|
const lang = await cloudron.getLanguage();
|
|
|
|
|
expect(lang).to.be('de');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|