checking if connecting to a source with no inputs throws an error

This commit is contained in:
Yotam Mann 2019-08-10 18:06:41 -04:00
parent d4bacbf4e8
commit 0dff2423e7

View file

@ -1,6 +1,7 @@
import { PassesAudio } from "@tonejs/plot";
import { expect } from "chai";
import { Offline } from "test/helper/Offline";
import { Oscillator } from "../source/oscillator/Oscillator";
import { connect, disconnect } from "./Connect";
import { Gain } from "./context/Gain";
@ -57,6 +58,16 @@ describe("Connect", () => {
expect(threwError).to.equal(true);
});
it ("throws an error if the destination has no input", () => {
const source = new Oscillator();
const gain = new Gain();
expect(() => {
gain.connect(source);
}).to.throw(Error);
gain.dispose();
source.dispose();
});
it("throws an error if things aren't connected to a specific channel", async () => {
let threwError = false;
await PassesAudio((context, input, output) => {