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
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Phaser } from "./Phaser.js";
|
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
import { EffectTests } from "../../test/helper/EffectTests.js";
|
|
import { expect } from "chai";
|
|
import { CompareToFile } from "../../test/helper/CompareToFile.js";
|
|
import { ToneAudioBuffer } from "../core/index.js";
|
|
import { Player } from "../source/buffer/Player.js";
|
|
|
|
describe("Phaser", () => {
|
|
BasicTests(Phaser);
|
|
EffectTests(Phaser);
|
|
|
|
it("matches a file basic", async () => {
|
|
const buffer = await ToneAudioBuffer.fromUrl("./test/audio/FWDL.wav");
|
|
return CompareToFile(
|
|
() => {
|
|
const phaser = new Phaser(2, 6, 200).toDestination();
|
|
const player = new Player(buffer).connect(phaser).start();
|
|
},
|
|
"phaser.wav",
|
|
0.1
|
|
);
|
|
});
|
|
|
|
context("API", () => {
|
|
it("can pass in options in the constructor", () => {
|
|
const phaser = new Phaser({
|
|
frequency: 0.2,
|
|
});
|
|
expect(phaser.frequency.value).to.be.closeTo(0.2, 0.01);
|
|
phaser.dispose();
|
|
});
|
|
|
|
it("can get/set the options", () => {
|
|
const phaser = new Phaser();
|
|
phaser.set({
|
|
octaves: 0.21,
|
|
baseFrequency: 300,
|
|
});
|
|
expect(phaser.get().baseFrequency).to.be.closeTo(300, 0.01);
|
|
expect(phaser.get().octaves).to.be.closeTo(0.21, 0.01);
|
|
phaser.dispose();
|
|
});
|
|
});
|
|
});
|