mirror of
https://github.com/got-feedBack/feedBack-desktop.git
synced 2026-09-11 01:44:11 +00:00
test(contracts): Phase 0.a contract snapshots for audio surface
Snapshot the three public surfaces the audio-engine decomposition must not change (docs/audio-engine-tlc.md Part IV §4): addon export table, audio-bridge IPC channels, preload audio/audioEffects API keys. contract-check.test.js diffs regenerated surfaces against the committed snapshots. result-shapes.json (golden result key/type shapes) is deferred until the engine_units harness can run the addon against a null device. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
745e360c89
commit
bbb3b58db8
@@ -0,0 +1,34 @@
|
||||
// Phase 0.a gate (docs/audio-engine-tlc.md §4): the public audio surface —
|
||||
// addon exports, IPC channels, preload API keys — must not change during the
|
||||
// decomposition phases. Removals/renames fail here; deliberate additions
|
||||
// require regenerating the snapshots in the same commit:
|
||||
// node tests/contracts/extract.js
|
||||
'use strict';
|
||||
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const { extractAddonExports, extractIpcChannels, extractPreloadApi } = require('./contracts/extract.js');
|
||||
|
||||
function loadSnapshot(name) {
|
||||
return JSON.parse(fs.readFileSync(path.join(__dirname, 'contracts', name), 'utf8'));
|
||||
}
|
||||
|
||||
test('addon export table matches snapshot', (t) => {
|
||||
const current = extractAddonExports();
|
||||
if (!current) {
|
||||
t.skip('slopsmith_audio.node not built');
|
||||
return;
|
||||
}
|
||||
assert.deepStrictEqual(current, loadSnapshot('addon-exports.json'));
|
||||
});
|
||||
|
||||
test('audio-bridge IPC channels match snapshot', () => {
|
||||
assert.deepStrictEqual(extractIpcChannels(), loadSnapshot('ipc-channels.json'));
|
||||
});
|
||||
|
||||
test('preload audio/audioEffects API keys match snapshot', () => {
|
||||
assert.deepStrictEqual(extractPreloadApi(), loadSnapshot('preload-audio-api.json'));
|
||||
});
|
||||
Reference in New Issue
Block a user