gabriel / musehub public
domain-palette.test.ts typescript
53 lines 1.7 KB
Raw
sha256:34035d72cef530c1ab9d6a6f53be18d803dde705fc3157617d70352a96d0747b Merge branch 'fix/wire-push-external-parent-manifest' into dev Human 8 days ago
1 import { describe, it, expect } from 'vitest';
2 import { domainColor, domainIcon, domainLabel, DOMAIN_VIEWER_PALETTE } from './domain-palette';
3
4 describe('DOMAIN_VIEWER_PALETTE', () => {
5 it('has exactly the v1 palette entries (musehub#117 DOM_09)', () => {
6 expect(Object.keys(DOMAIN_VIEWER_PALETTE).sort()).toEqual(
7 ['generic', 'piano_roll', 'symbol_graph'].sort()
8 );
9 });
10 });
11
12 describe('domainColor', () => {
13 it('returns the symbol_graph color', () => {
14 expect(domainColor('symbol_graph')).toBe('#58a6ff');
15 });
16
17 it('returns the piano_roll color', () => {
18 expect(domainColor('piano_roll')).toBe('#bc8cff');
19 });
20
21 it('falls back to generic color for unknown viewer types', () => {
22 expect(domainColor('totally_unknown')).toBe(DOMAIN_VIEWER_PALETTE.generic.color);
23 });
24 });
25
26 describe('domainIcon', () => {
27 it('returns distinct icons per known viewer type', () => {
28 expect(domainIcon('symbol_graph')).toBe('⬡');
29 expect(domainIcon('piano_roll')).toBe('♪');
30 });
31
32 it('falls back to generic icon for unknown viewer types', () => {
33 expect(domainIcon('nonsense')).toBe(DOMAIN_VIEWER_PALETTE.generic.icon);
34 });
35 });
36
37 describe('domainLabel', () => {
38 it('prefers a real domain name over the palette label', () => {
39 expect(domainLabel('symbol_graph', 'My Domain')).toBe('My Domain');
40 });
41
42 it('falls back to the palette label when name is missing', () => {
43 expect(domainLabel('piano_roll')).toBe('MIDI');
44 });
45
46 it('falls back to the palette label when name is "Unknown"', () => {
47 expect(domainLabel('symbol_graph', 'Unknown')).toBe('Code');
48 });
49
50 it('falls back to generic label for unknown viewer types with no name', () => {
51 expect(domainLabel('mystery')).toBe('Generic');
52 });
53 });
File History 3 commits
sha256:34035d72cef530c1ab9d6a6f53be18d803dde705fc3157617d70352a96d0747b Merge branch 'fix/wire-push-external-parent-manifest' into dev Human 8 days ago
sha256:fc04e4cae9e1774d6a21b65c45daeed0e6787eb581d13aa1b03bfe9384a34226 Merge branch 'fix/two-column-scroll-layout' into dev Human 8 days ago
sha256:408916fc5973ba59c6e4eebaa80ebdcc801c0a63205651e25009d11548f79454 chore: bump version to 0.2.0.dev2 — nightly.2, matching muse Sonnet 4.6 patch 11 days ago