Plugin & Theme System: - Add plugin type definitions, permissions (30+), and validation constants - Add IndexedDB storage layer for plugin code, theme CSS, and previews - Add theme CSS sanitization, injection, and safety validation - Add HookBus event system with 130+ hooks across 20 domains - Add plugin ZIP extraction and manifest validation with JS security checks - Add sandboxed PluginAPI factory with scoped storage, logging, and permission gating - Add plugin loader with blob URL dynamic import and auto-disable circuit breaker - Add 3 built-in themes (Nord, Catppuccin, Solarized) - Add Zustand plugin store with install/uninstall/enable/disable lifecycle - Add PluginSlot, PluginSlotRenderer, and PluginErrorBoundary components - Add plugins and themes settings UI panels - Integrate plugin slots into email viewer, composer, navigation rail, sidebar, and context menu - Extend theme store with custom theme installation and activation Admin Dashboard: - Add admin authentication with scrypt password hashing and AES-256-GCM sessions - Add rate-limited login (5 attempts/15min per IP) - Add config manager with admin override > env var > default priority - Add settings policy system with feature gates and per-setting restrictions - Add audit logging with rotation - Add admin API routes (login, logout, config, policy, audit, password change) - Add admin UI pages (login, dashboard, config, policy, audit) - Add policy store for client-side feature gate enforcement - Wire admin password initialization into server instrumentation Tests: - Add 139 tests across 10 test files covering all plugin/theme modules
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { BUILTIN_THEMES } from '../builtin-themes';
|
|
|
|
describe('BUILTIN_THEMES', () => {
|
|
it('contains exactly 3 themes', () => {
|
|
expect(BUILTIN_THEMES).toHaveLength(3);
|
|
});
|
|
|
|
it('all themes have required fields', () => {
|
|
for (const theme of BUILTIN_THEMES) {
|
|
expect(theme.id).toBeTruthy();
|
|
expect(theme.name).toBeTruthy();
|
|
expect(theme.version).toBeTruthy();
|
|
expect(theme.author).toBe('Built-in');
|
|
expect(theme.css).toBeTruthy();
|
|
expect(theme.variants).toEqual(['light', 'dark']);
|
|
expect(theme.enabled).toBe(true);
|
|
expect(theme.builtIn).toBe(true);
|
|
}
|
|
});
|
|
|
|
it('all IDs are prefixed with builtin-', () => {
|
|
for (const theme of BUILTIN_THEMES) {
|
|
expect(theme.id).toMatch(/^builtin-/);
|
|
}
|
|
});
|
|
|
|
it('all themes have both :root and .dark selectors', () => {
|
|
for (const theme of BUILTIN_THEMES) {
|
|
expect(theme.css).toContain(':root');
|
|
expect(theme.css).toContain('.dark');
|
|
}
|
|
});
|
|
|
|
it('all themes set --color-primary', () => {
|
|
for (const theme of BUILTIN_THEMES) {
|
|
expect(theme.css).toContain('--color-primary:');
|
|
}
|
|
});
|
|
|
|
it('themes have correct names', () => {
|
|
const names = BUILTIN_THEMES.map(t => t.name);
|
|
expect(names).toContain('Nord');
|
|
expect(names).toContain('Catppuccin');
|
|
expect(names).toContain('Solarized');
|
|
});
|
|
|
|
it('theme IDs are unique', () => {
|
|
const ids = BUILTIN_THEMES.map(t => t.id);
|
|
expect(new Set(ids).size).toBe(ids.length);
|
|
});
|
|
});
|