mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 19:43:12 +00:00
14 lines
466 B
TypeScript
14 lines
466 B
TypeScript
import { expect } from "chai";
|
|
import { OfflineContext } from "Tone/core/context/OfflineContext";
|
|
import { Offline } from "./Offline";
|
|
|
|
/**
|
|
* Test that the output of the callback is a constant value
|
|
*/
|
|
export async function ConstantOutput(
|
|
callback: (context: OfflineContext) => Promise<void> | void,
|
|
value: number, threshold = 0.01,
|
|
): Promise<void> {
|
|
const buffer = await Offline(callback, 0.01, 1);
|
|
expect(buffer.value()).to.be.closeTo(value, threshold);
|
|
}
|