1 | import { expect } from "chai";
|
2 | import { OfflineContext } from "./core/context/OfflineContext.js";
|
3 | import { fromContext } from "./fromContext.js";
|
4 |
|
5 | describe("fromContext", () => {
|
6 | let context: OfflineContext;
|
7 |
|
8 | before(() => {
|
9 | context = new OfflineContext(1, 1, 44100);
|
10 | });
|
11 |
|
12 | after(() => {
|
13 | context.dispose();
|
14 | });
|
15 |
|
16 | it("creates an object from a context", () => {
|
17 | const tone = fromContext(context);
|
18 | const osc = new tone.Oscillator();
|
19 | expect(osc.context).to.equal(context);
|
20 | osc.dispose();
|
21 | });
|
22 |
|
23 | it("units are relative to the passed in context's timing", () => {
|
24 | const tone = fromContext(context);
|
25 | expect(tone.Time("+0.5").valueOf()).to.equal(0.5);
|
26 | });
|
27 | });
|