mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-28 04:23:15 +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
44 lines
1,003 B
TypeScript
44 lines
1,003 B
TypeScript
import { expect } from "chai";
|
|
import { BasicTests } from "../../../test/helper/Basic.js";
|
|
import { Noise } from "../../source/Noise.js";
|
|
import { Waveform } from "./Waveform.js";
|
|
|
|
describe("Waveform", () => {
|
|
BasicTests(Waveform);
|
|
|
|
it("can get and set properties", () => {
|
|
const anl = new Waveform();
|
|
anl.set({
|
|
size: 128,
|
|
});
|
|
const values = anl.get();
|
|
expect(values.size).to.equal(128);
|
|
anl.dispose();
|
|
});
|
|
|
|
it("can correctly set the size", () => {
|
|
const anl = new Waveform(512);
|
|
expect(anl.size).to.equal(512);
|
|
anl.size = 1024;
|
|
expect(anl.size).to.equal(1024);
|
|
anl.dispose();
|
|
});
|
|
|
|
it("can run waveform analysis", (done) => {
|
|
const noise = new Noise();
|
|
const anl = new Waveform(256);
|
|
noise.connect(anl);
|
|
noise.start();
|
|
|
|
setTimeout(() => {
|
|
const analysis = anl.getValue();
|
|
expect(analysis.length).to.equal(256);
|
|
analysis.forEach((value) => {
|
|
expect(value).is.within(-1, 1);
|
|
});
|
|
anl.dispose();
|
|
noise.dispose();
|
|
done();
|
|
}, 300);
|
|
});
|
|
});
|