Tidy test and console logs

This commit is contained in:
alex 2022-04-21 14:17:28 +01:00
parent b370c405da
commit 3ae6443c59
2 changed files with 3 additions and 19 deletions

View File

@ -714,21 +714,6 @@ export class Pattern {
_velocity(velocity) {
return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity }));
}
add(other) {
return this._asNumber()._opLeft(other, (a) => (b) => a + b);
}
sub(other) {
return this._asNumber()._opLeft(other, (a) => (b) => a - b);
}
mul(other) {
return this._asNumber()._opLeft(other, (a) => (b) => a * b);
}
div(other) {
return this._asNumber()._opLeft(other, (a) => (b) => a / b);
}
}
// pattern composers
@ -741,7 +726,6 @@ const composers = {
};
for (const [name, op] of Object.entries(composers)) {
console.log(`Adding ${name}`);
Pattern.prototype[name] = function (other) {
return op[1](this)._opLeft(other, op[0]);
};

View File

@ -161,11 +161,11 @@ describe('Pattern', function () {
assert.equal(pure(3).div(pure(2)).firstCycle()[0].value, 1.5);
});
});
describe('union()', function () {
it('Can union things', function () {
describe('set()', function () {
it('Can set things', function () {
assert.deepStrictEqual(
pure({ a: 4, b: 6 })
.union(pure({ c: 7 }))
.set(pure({ c: 7 }))
.firstCycle()[0].value,
{ a: 4, b: 6, c: 7 },
);