This commit is contained in:
@@ -237,3 +237,36 @@ test('A/B WAV exports preserve coefficients and signed zero', () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("each FIR analysis rechecks live switch, including enabled then disabled", async () => {
|
||||
let enabled = 1;
|
||||
const calls = [];
|
||||
const coefficients = pair();
|
||||
const api = {
|
||||
async getDeviceState() { calls.push("state"); return {fir_enable: enabled}; },
|
||||
async getFirChannel(channel) { calls.push(channel); return binary(coefficients[channel]); },
|
||||
};
|
||||
await fir.readEnabledCurrentFir(api);
|
||||
assert.deepEqual(calls, ["state", "left", "right"]);
|
||||
enabled = 0;
|
||||
calls.length = 0;
|
||||
await assert.rejects(() => fir.readEnabledCurrentFir(api), /Effect → FIR/);
|
||||
assert.deepEqual(calls, ["state"]);
|
||||
});
|
||||
|
||||
test("unknown or failed FIR switch reads block all coefficient reads", async () => {
|
||||
for (const getDeviceState of [async () => ({}), async () => { throw new Error("offline"); }]) {
|
||||
let reads = 0;
|
||||
await assert.rejects(() => fir.readEnabledCurrentFir({getDeviceState, async getFirChannel() { reads++; }}));
|
||||
assert.equal(reads, 0);
|
||||
}
|
||||
});
|
||||
|
||||
test("proposal prerequisite also checks live switch every time", async () => {
|
||||
let enabled = 1;
|
||||
const api = {async getDeviceState() { return {fir_enable: enabled}; }};
|
||||
await fir.requireFirEnabled(api);
|
||||
enabled = 0;
|
||||
await assert.rejects(() => fir.requireFirEnabled(api), /Effect → FIR/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user