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
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { expect } from "chai";
|
|
import { Offline } from "../../../test/helper/Offline.js";
|
|
import { TransportClass } from "./Transport.js";
|
|
import { TransportEvent } from "./TransportEvent.js";
|
|
|
|
describe("TransportEvent", () => {
|
|
it("can be created and disposed", () => {
|
|
return Offline((context) => {
|
|
const transport = new TransportClass({ context });
|
|
const event = new TransportEvent(transport, {
|
|
time: 0,
|
|
});
|
|
event.dispose();
|
|
});
|
|
});
|
|
|
|
it("has a unique id", () => {
|
|
return Offline((context) => {
|
|
const transport = new TransportClass({ context });
|
|
const event = new TransportEvent(transport, {
|
|
time: 0,
|
|
});
|
|
expect(event.id).to.be.a("number");
|
|
event.dispose();
|
|
});
|
|
});
|
|
|
|
it("can invoke the callback", () => {
|
|
let wasInvoked = false;
|
|
return Offline((context) => {
|
|
const transport = new TransportClass({ context });
|
|
const event = new TransportEvent(transport, {
|
|
callback: (time) => {
|
|
expect(time).to.equal(100);
|
|
wasInvoked = true;
|
|
},
|
|
time: 0,
|
|
});
|
|
event.invoke(100);
|
|
}).then(() => {
|
|
expect(wasInvoked).to.equal(true);
|
|
});
|
|
});
|
|
});
|