Tone.js/Tone/component/dynamics/Limiter.test.ts
Yotam Mann aaf880c925
Using web-test-runner for tests, updating import paths (#1242)
* 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
2024-05-03 14:31:14 -04:00

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();
});
});
});