gabriel / musehub public
domain-palette.test.ts typescript
53 lines 1.7 KB
Raw
sha256:cfefc25a166c3c3eed8ea3529aee19ea350bc05f2954d007420e924133b7d8ce chore: pivot to nightly channel — bump version to 0.2.0.dev… Sonnet 5 patch 13 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 1 commit
sha256:cfefc25a166c3c3eed8ea3529aee19ea350bc05f2954d007420e924133b7d8ce chore: pivot to nightly channel — bump version to 0.2.0.dev… Sonnet 5 patch 13 days ago