Add comprehensive test coverage for Ableton automation, fader policies, and pad sound export logic

This commit is contained in:
2026-07-14 11:27:57 +02:00
parent 4cda706b69
commit d582adb3fc
3 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {
getPadEnvelopeState,
getPadSoundState,
} from '../src/lib/exporters/ableton/padSound';
import { AblTrack } from '../src/lib/transformers/ableton';
const track = {
volume: 0.75,
pitch: -3,
playMode: 'key',
pan: 0.25,
trimLeft: 100,
trimRight: 1000,
attack: 64,
release: 128,
timeStretch: 'bars',
timeStretchBpm: 92,
timeStretchBars: 2,
rootNote: 48,
soundLength: 4,
} as AblTrack;
test('keeps static pad sound settings separate from group fader state', () => {
assert.deepEqual(getPadSoundState(track), {
amp: 0.75,
pitch: -3,
playMode: 'key',
pan: 0.25,
trimStart: 100,
trimEnd: 1000,
envelope: { attack: 64, release: 128 },
time: { mode: 'bars', bpm: 92, bars: 2 },
rootNote: 48,
soundLength: 4,
});
});
test('maps only pad ENV values into the static Classic envelope', () => {
const envelope = getPadEnvelopeState(getPadSoundState(track));
assert.equal(envelope.classicAttackMs, (64 / 255) * 4000);
assert.equal(envelope.classicReleaseMs, (128 / 255) * 4000);
assert.equal(envelope.oneShotFadeInMs, 0);
assert.equal(envelope.oneShotFadeOutMs, 5);
});