mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-12 11:58:45 +00:00
aaf880c925
* WIP moving tests to web-test-runner * updating thresholds * Adding file extensions * Testing integrations * linting * fixing dep * moving back to root dir * prettier all of the files * updating eslint rules to use with prettier * remove import package * moving tsignore around * removing unneeded ignores * all tests run on puppeteer, no need for testing guards * linting * import type syntax * cleaning up * Update package.json
40 lines
1 KiB
TypeScript
40 lines
1 KiB
TypeScript
import { Limiter } from "./Limiter.js";
|
|
import { BasicTests } from "../../../test/helper/Basic.js";
|
|
import { PassAudio } from "../../../test/helper/PassAudio.js";
|
|
import { expect } from "chai";
|
|
|
|
describe("Limiter", () => {
|
|
BasicTests(Limiter);
|
|
|
|
context("Limiting", () => {
|
|
it("passes the incoming signal through", () => {
|
|
return PassAudio((input) => {
|
|
const limiter = new Limiter().toDestination();
|
|
input.connect(limiter);
|
|
});
|
|
});
|
|
|
|
it("can be get and set through object", () => {
|
|
const limiter = new Limiter();
|
|
const values = {
|
|
threshold: -30,
|
|
};
|
|
limiter.set(values);
|
|
expect(limiter.get().threshold).to.be.closeTo(-30, 0.1);
|
|
limiter.dispose();
|
|
});
|
|
|
|
it("can set the threshold", () => {
|
|
const limiter = new Limiter();
|
|
limiter.threshold.value = -10;
|
|
expect(limiter.threshold.value).to.be.closeTo(-10, 0.1);
|
|
limiter.dispose();
|
|
});
|
|
|
|
it("reduction is 0 when not connected", () => {
|
|
const limiter = new Limiter();
|
|
expect(limiter.reduction).to.be.closeTo(0, 0.01);
|
|
limiter.dispose();
|
|
});
|
|
});
|
|
});
|