kevinkickback_Combo-Colors/tests/patterns.test.ts
kevinkickback f5b8958691 feat: enhance profile management and validation
- Introduced functions for cloning profiles and creating default settings.
- Added validation for profile IDs and input names, ensuring they meet specific criteria.
- Implemented color validation for CSS colors to ensure safe usage.
- Enhanced settings merging logic to prevent mutation of default settings.
- Added new classes for managing styles dynamically based on profiles.
- Implemented a mode toggle for rendering notations as images or text.
- Created a notation observer to handle dynamic updates in the UI.
- Added comprehensive tests for input validation, profile validation, and mode toggling functionality.
- Removed deprecated button styling from CSS.
2026-05-13 17:28:07 -07:00

46 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
canonicalMotionMap,
generateButtonMap,
getMissingCanonicalMotionConfigs,
} from '../src/patterns'
const testProfile = {
name: 'Test Profile',
desc: {
A: 'Light attack',
LP: 'Light punch',
K: 'Kick',
},
colors: {
A: '#ffffff',
LP: '#eeeeee',
K: '#dddddd',
},
}
describe('patterns', () => {
it('creates a button map for each configured input', () => {
const map = generateButtonMap(testProfile)
expect(map.size).toBe(Object.keys(testProfile.colors).length)
const lpEntry = map.get('LP')
expect(lpEntry).toBeTruthy()
expect(lpEntry?.alt).toBe('LP')
expect(lpEntry?.class).toBe('buttonIcon')
})
it('creates canonical motion lookup for parser tokens', () => {
const map = canonicalMotionMap()
expect(map.get('qcf')?.alt).toBe('QCF')
expect(map.get('qcb')?.alt).toBe('QCB')
expect(map.get('dp')?.alt).toBe('DP')
expect(map.get('neutral')?.alt).toBe('')
})
it('covers all canonical schema values with motion configs', () => {
expect(getMissingCanonicalMotionConfigs()).toEqual([])
})
})