UI-Improvements
This commit is contained in:
@@ -12,7 +12,7 @@ import { DatabaseModule } from '../../backend/src/database/database.module';
|
||||
import { DatabaseInitService } from '../../backend/src/database/database-init.service';
|
||||
import { THEME_IDS } from '../../backend/src/common/types/theme-ids';
|
||||
|
||||
describe('ThemeLoaderService - require 10 + validate configured key', () => {
|
||||
describe('ThemeLoaderService - require canonical + validate configured key', () => {
|
||||
let app: INestApplication;
|
||||
let svc: ThemeLoaderService;
|
||||
|
||||
@@ -41,12 +41,12 @@ describe('ThemeLoaderService - require 10 + validate configured key', () => {
|
||||
if (app) await app.close();
|
||||
});
|
||||
|
||||
it('exposes all 10 canonical theme ids even when THEMES_DIR is empty', async () => {
|
||||
it('exposes all canonical theme ids even when THEMES_DIR is empty', async () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'themes-empty-'));
|
||||
await buildApp(tmp, 'classic');
|
||||
await buildApp(tmp, 'hip');
|
||||
const ids = svc.listThemes().map((t) => t.id).sort();
|
||||
expect(ids).toEqual([
|
||||
'classic', 'crimson', 'cyber', 'forest', 'midnight',
|
||||
'classic', 'crimson', 'cyber', 'forest', 'hip', 'midnight',
|
||||
'monochrome', 'neon', 'ocean', 'paper', 'sunset',
|
||||
]);
|
||||
expect(svc.listThemes().length).toBe(THEME_IDS.length);
|
||||
@@ -54,8 +54,7 @@ describe('ThemeLoaderService - require 10 + validate configured key', () => {
|
||||
|
||||
it('backfills missing disk themes with built-ins (per-id warn)', async () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'themes-partial-'));
|
||||
// Only write 3 of the 10 themes to disk.
|
||||
for (const id of ['classic', 'midnight', 'cyber']) {
|
||||
for (const id of ['hip', 'classic', 'midnight', 'cyber']) {
|
||||
fs.writeFileSync(path.join(tmp, `${id}.json`), JSON.stringify({
|
||||
id,
|
||||
name: id,
|
||||
@@ -67,7 +66,7 @@ describe('ThemeLoaderService - require 10 + validate configured key', () => {
|
||||
},
|
||||
}));
|
||||
}
|
||||
await buildApp(tmp, 'classic');
|
||||
await buildApp(tmp, 'hip');
|
||||
expect(svc.listThemes().length).toBe(THEME_IDS.length);
|
||||
});
|
||||
|
||||
@@ -79,21 +78,21 @@ describe('ThemeLoaderService - require 10 + validate configured key', () => {
|
||||
expect(theme.id).toBe('ocean');
|
||||
});
|
||||
|
||||
it('falls back to classic and warns when configured themeKey is invalid', async () => {
|
||||
it('falls back to default and warns when configured themeKey is invalid', async () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'themes-'));
|
||||
await buildApp(tmp, 'this-theme-does-not-exist');
|
||||
expect(svc.getDefaultId()).toBe('classic');
|
||||
expect(svc.getDefaultId()).toBe('hip');
|
||||
});
|
||||
|
||||
it('falls back to classic and warns when configured themeKey is empty', async () => {
|
||||
it('falls back to default and warns when configured themeKey is empty', async () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'themes-'));
|
||||
await buildApp(tmp, '');
|
||||
expect(svc.getDefaultId()).toBe('classic');
|
||||
expect(svc.getDefaultId()).toBe('hip');
|
||||
});
|
||||
|
||||
it('getTheme() returns a real theme for any canonical id', async () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'themes-'));
|
||||
await buildApp(tmp, 'classic');
|
||||
await buildApp(tmp, 'hip');
|
||||
for (const id of THEME_IDS) {
|
||||
expect(svc.getTheme(id).id).toBe(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user