mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 19:43:12 +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
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { expect } from "chai";
|
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
import { CompareToFile } from "../../test/helper/CompareToFile.js";
|
|
import { EffectTests } from "../../test/helper/EffectTests.js";
|
|
import { Oscillator } from "../source/oscillator/Oscillator.js";
|
|
import { Distortion } from "./Distortion.js";
|
|
|
|
describe("Distortion", () => {
|
|
BasicTests(Distortion);
|
|
EffectTests(Distortion);
|
|
|
|
it("matches a file", () => {
|
|
return CompareToFile(
|
|
() => {
|
|
const dist = new Distortion(0.8).toDestination();
|
|
const osc = new Oscillator().connect(dist);
|
|
osc.type = "square";
|
|
osc.start(0).stop(0.4);
|
|
},
|
|
"distortion.wav",
|
|
0.02
|
|
);
|
|
});
|
|
|
|
context("API", () => {
|
|
it("can pass in options in the constructor", () => {
|
|
const dist = new Distortion({
|
|
distortion: 0.2,
|
|
});
|
|
expect(dist.distortion).to.be.closeTo(0.2, 0.01);
|
|
dist.dispose();
|
|
});
|
|
|
|
it("can get/set the options", () => {
|
|
const dist = new Distortion();
|
|
dist.set({
|
|
oversample: "4x",
|
|
});
|
|
expect(dist.get().oversample).to.equal("4x");
|
|
dist.dispose();
|
|
});
|
|
});
|
|
});
|