UI-Improvements

This commit is contained in:
m0rph3us1987
2026-07-24 12:58:34 +02:00
parent 143ed3c538
commit b99577e76a
40 changed files with 2202 additions and 821 deletions
@@ -1,9 +1,6 @@
process.env.DATABASE_PATH = ':memory:';
process.env.FRONTEND_DIST = './frontend/dist';
process.env.NODE_ENV = 'test';
// Intentionally do NOT set process.env.THEMES_DIR — this spec exercises the
// default path-resolution behaviour so the test fails if the default ever
// regresses to a CWD-relative path.
import { AdminGeneralService } from '../../backend/src/modules/admin/general.service';
import { THEME_IDS } from '../../backend/src/common/types/theme-ids';
@@ -20,16 +17,14 @@ describe('AdminGeneralService.listThemes - default THEMES_DIR resolution (Job 89
const fakeSettings = { get: jest.fn(), set: jest.fn() } as any;
const fakeHub = { emitEvent: jest.fn() } as any;
const fakeThemes = { listThemes: () => makeFakeThemeLoader() } as any;
// Mimic the production Nest ConfigService: .get('THEMES_DIR', './themes')
// returns the literal default string when no env override is present.
const fakeConfig = {
get: jest.fn().mockImplementation((key: string, fallback?: any) => fallback),
} as any;
it('returns all 10 canonical themes when THEMES_DIR is left at its default', () => {
it('returns all canonical themes when THEMES_DIR is left at its default', () => {
const svc = new AdminGeneralService(fakeSettings, fakeThemes, fakeHub, fakeConfig);
const themes = svc.listThemes();
expect(themes.length).toBe(10);
expect(themes.length).toBe(THEME_IDS.length);
const ids = themes.map((t) => t.id).sort();
expect(ids).toEqual([...THEME_IDS].sort());
});
@@ -44,11 +39,11 @@ describe('AdminGeneralService.listThemes - default THEMES_DIR resolution (Job 89
}
});
it('produces the same 10-entry list on repeated calls (no I/O ordering surprises)', () => {
it('produces the same canonical entry list on repeated calls', () => {
const svc = new AdminGeneralService(fakeSettings, fakeThemes, fakeHub, fakeConfig);
const a = svc.listThemes().map((t) => t.id).sort();
const b = svc.listThemes().map((t) => t.id).sort();
expect(b).toEqual(a);
expect(a.length).toBe(10);
expect(a.length).toBe(THEME_IDS.length);
});
});