update at 2026-01-23 23:20:39
This commit is contained in:
@@ -22,13 +22,14 @@ describe('configParser', () => {
|
||||
|
||||
expect(config.name).toBe('demo');
|
||||
expect(config.layers.length).toBeGreaterThan(0);
|
||||
expect(config.theme.colorPalettes['木']).toBe('#43A047');
|
||||
expect(config.themeRef).toBe('五行配色主题');
|
||||
expect(config.theme).toBeUndefined();
|
||||
expect(config.layers.some((layer) => layer.type === 'centerIcon')).toBe(true);
|
||||
expect(config.layers.some((layer) => layer.type === 'degreeRing')).toBe(true);
|
||||
});
|
||||
|
||||
it('缺少必填字段时应抛错', () => {
|
||||
const raw = '{ "background": "#000", "theme": { "colorPalettes": {} }, "layers": [] }';
|
||||
const raw = '{ "background": "#000", "layers": [] }';
|
||||
expect(() => parseConfig(raw)).toThrow('name 为必填字符串');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user