Tone.js/Tone/core/clock/TransportRepeatEvent.test.ts
Yotam Mann 3d42017f50
Deprecating singleton variables, use singleton getter instead (#1233)
* Deprecating singleton variables, use singleton getter instead

* updating references

* moving over to getters instead of global vars
2024-04-28 13:05:26 -04:00

43 lines
1.1 KiB
TypeScript

import { expect } from "chai";
import { Offline } from "test/helper/Offline";
import { TransportClass } from "./Transport";
import { TransportRepeatEvent } from "./TransportRepeatEvent";
describe("TransportRepeatEvent", () => {
it("can be created and disposed", () => {
return Offline((context) => {
const transport = new TransportClass({ context });
const event = new TransportRepeatEvent(transport, {
duration: 100,
interval: 4,
time: 0,
});
event.dispose();
});
});
it("generates a unique event ID", () => {
return Offline((context) => {
const transport = new TransportClass({ context });
const event = new TransportRepeatEvent(transport, {
time: 0,
});
expect(event.id).to.be.a("number");
event.dispose();
});
});
it("is removed from the Transport when disposed", () => {
return Offline((context) => {
const transport = new TransportClass({ context });
const event = new TransportRepeatEvent(transport, {
time: 0,
});
event.dispose();
// @ts-ignore
expect(transport._timeline.length).to.equal(0);
});
});
});