more cleaning up
This commit is contained in:
parent
2c7d72a699
commit
560398fefb
110 changed files with 931 additions and 2645 deletions
|
|
@ -4,17 +4,6 @@ import { gardenAudioConfig } from './audio/garden-audio-config';
|
|||
import { getInitialVibe, hexToRgb, VIBE_PRESETS } from './vibes';
|
||||
|
||||
const originalLocalStorage = globalThis.localStorage;
|
||||
const colorInteractionKeys = [
|
||||
'color1ToColor1',
|
||||
'color1ToColor2',
|
||||
'color1ToColor3',
|
||||
'color2ToColor1',
|
||||
'color2ToColor2',
|
||||
'color2ToColor3',
|
||||
'color3ToColor1',
|
||||
'color3ToColor2',
|
||||
'color3ToColor3',
|
||||
] as const;
|
||||
|
||||
const setBrowserVibeState = ({
|
||||
storedVibeId = null,
|
||||
|
|
@ -53,13 +42,11 @@ describe('vibe selection', () => {
|
|||
});
|
||||
|
||||
describe('vibe and audio config contract', () => {
|
||||
it('keeps preset ids unique, URL-safe, and covered by audio profiles', () => {
|
||||
it('keeps preset ids unique and URL-safe', () => {
|
||||
const vibeIds = VIBE_PRESETS.map((vibe) => vibe.id);
|
||||
const audioIds = Object.keys(gardenAudioConfig.vibes);
|
||||
|
||||
expect(new Set(vibeIds).size).toBe(vibeIds.length);
|
||||
expect(vibeIds.every((id) => /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(id))).toBe(true);
|
||||
expect(audioIds.slice().sort()).toEqual(vibeIds.slice().sort());
|
||||
});
|
||||
|
||||
it('keeps each vibe palette and audio profile complete', () => {
|
||||
|
|
@ -73,7 +60,7 @@ describe('vibe and audio config contract', () => {
|
|||
});
|
||||
});
|
||||
|
||||
const profile = gardenAudioConfig.vibes[vibe.id];
|
||||
const profile = vibe.audio;
|
||||
expect(Number.isFinite(profile.rootMidi)).toBe(true);
|
||||
expect(profile.scale.length).toBeGreaterThan(0);
|
||||
expect(profile.scale.every((degree) => Number.isFinite(degree))).toBe(true);
|
||||
|
|
@ -87,9 +74,11 @@ describe('vibe and audio config contract', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('keeps audio color voices aligned with the three vibe palette slots', () => {
|
||||
expect(gardenAudioConfig.colorVoices).toHaveLength(3);
|
||||
gardenAudioConfig.colorVoices.forEach((voice) => {
|
||||
it('keeps audio style voices aligned with the rotating style pools', () => {
|
||||
expect(gardenAudioConfig.styleVoices).toHaveLength(
|
||||
gardenAudioConfig.generativePiano.stylePools.length
|
||||
);
|
||||
gardenAudioConfig.styleVoices.forEach((voice) => {
|
||||
expect(Number.isFinite(voice.scaleDegreeOffset)).toBe(true);
|
||||
expect(voice.velocityMultiplier).toBeGreaterThan(0);
|
||||
expect(Math.abs(voice.panOffset)).toBeLessThanOrEqual(1);
|
||||
|
|
@ -100,15 +89,4 @@ describe('vibe and audio config contract', () => {
|
|||
expect(hexToRgb('not-a-color')).toEqual([0, 0, 0]);
|
||||
expect(hexToRgb('#abcdzz')).toEqual([0, 0, 0]);
|
||||
});
|
||||
|
||||
it('uses discrete color interaction matrices for every vibe', () => {
|
||||
VIBE_PRESETS.forEach((vibe) => {
|
||||
colorInteractionKeys.forEach((key) => {
|
||||
expect([-1, 0, 1]).toContain(vibe.settings[key]);
|
||||
});
|
||||
expect(vibe.settings.color1ToColor1).toBe(1);
|
||||
expect(vibe.settings.color2ToColor2).toBe(1);
|
||||
expect(vibe.settings.color3ToColor3).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue