Test that nested Live 10 Simpler devices are serialized with IDs

This commit is contained in:
2026-07-14 08:17:51 +02:00
parent 339b8b4a8c
commit 450cf3715a

View File

@@ -1,5 +1,7 @@
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import test from 'node:test'; import test from 'node:test';
import { gunzipSync } from 'node:zlib';
import { createServer } from 'vite';
import { assignDeviceListIds } from '../src/lib/exporters/ableton/builders'; import { assignDeviceListIds } from '../src/lib/exporters/ableton/builders';
import abletonTransformer, { AblTrack, getDrumRackMidiNote } from '../src/lib/transformers/ableton'; import abletonTransformer, { AblTrack, getDrumRackMidiNote } from '../src/lib/transformers/ableton';
import { import {
@@ -154,6 +156,37 @@ test('assigns IDs to every device-list member, including nested rack devices', (
assert.equal(devices[1].AutoFilter['@Id'], 1); assert.equal(devices[1].AutoFilter['@Id'], 1);
}); });
test('serializes every nested Live 10 Simpler as an identified list member', async () => {
const server = await createServer({
server: { middlewareMode: true },
appType: 'custom',
mode: 'production',
});
try {
const { buildProject } = await server.ssrLoadModule(
'/src/lib/exporters/ableton/builders.ts',
);
const generated = await buildProject(project(), {
abletonVersion: '10',
includeArchivedSamples: true,
clips: false,
groupTracks: true,
sendEffects: false,
allScenes: true,
});
const xml = gunzipSync(Buffer.from(generated)).toString('utf8');
const simplerTags = [...xml.matchAll(/<OriginalSimpler(?:\s[^>]*)?>/g)].map(
(match) => match[0],
);
assert.ok(simplerTags.length > 0);
assert.ok(simplerTags.every((tag) => /\sId="\d+"/.test(tag)));
} finally {
await server.close();
}
});
test('automatically builds a per-group rack without flattening chromatic pads', () => { test('automatically builds a per-group rack without flattening chromatic pads', () => {
const result = abletonTransformer(project(), { const result = abletonTransformer(project(), {
includeArchivedSamples: true, includeArchivedSamples: true,