Added additional test for loop iteration

addresses #778
This commit is contained in:
Yotam Mann 2021-01-13 12:21:16 -05:00
parent 0b7a352f7a
commit de1dddc5b9

View file

@ -575,6 +575,25 @@ describe("Part", () => {
}); });
}); });
it("can loop a specific number of times (different set order)", () => {
let callCount = 0;
const times = [0.1, 0.2, 0.4, 0.5];
return Offline(({ transport }) => {
const part = new Part({
events: [0, 0.1],
callback(time): void {
expect(times[callCount]).to.be.closeTo(time, 0.01);
callCount++;
},
}).start(0.1);
part.loop = 2;
part.loopEnd = 0.3;
transport.start();
}, 0.8).then(() => {
expect(callCount).to.equal(4);
});
});
it("plays once when loop is 1", () => { it("plays once when loop is 1", () => {
let callCount = 0; let callCount = 0;
return Offline(({ transport }) => { return Offline(({ transport }) => {