AI Implementation feature(820): Project Scaffold and Platform Foundations (#1)
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import { ThemeLoaderService, BUILTIN_THEMES } from '../../backend/src/common/utils/theme-loader.service';
|
||||
|
||||
describe('ThemeLoaderService builtins', () => {
|
||||
it('includes all 10 canonical theme ids', () => {
|
||||
const ids = BUILTIN_THEMES.map((t) => t.id).sort();
|
||||
expect(ids).toEqual([
|
||||
'classic', 'crimson', 'cyber', 'forest', 'midnight',
|
||||
'monochrome', 'neon', 'ocean', 'paper', 'sunset',
|
||||
]);
|
||||
});
|
||||
|
||||
it('every builtin theme has full tokens', () => {
|
||||
for (const t of BUILTIN_THEMES) {
|
||||
expect(t.tokens.primary).toMatch(/^#/);
|
||||
expect(t.tokens.radii.sm).toBeTruthy();
|
||||
expect(t.tokens.spacingScale.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('falls back to default for unknown id', () => {
|
||||
const config = { get: jest.fn((k: string, d: any) => d) } as any;
|
||||
const settings = { get: jest.fn().mockResolvedValue('classic') } as any;
|
||||
const svc = new ThemeLoaderService(config, settings);
|
||||
return svc.onModuleInit().then(() => {
|
||||
const t = svc.getTheme('totally-unknown');
|
||||
expect(t.id).toBe('classic');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user