From 95a575fd2d32be347c8b4915e4e4e4abd4ea0f99 Mon Sep 17 00:00:00 2001 From: David Braun Date: Tue, 13 Mar 2018 16:59:17 -0400 Subject: [PATCH] Fix #2. --- lib/index.js | 7 +++++-- test/index.js | 12 ------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/index.js b/lib/index.js index 656248e..7142d39 100644 --- a/lib/index.js +++ b/lib/index.js @@ -235,7 +235,9 @@ const Channel = function(length = 0) { const { order, promise } = Order(this); shifts.push(order); setImmediate(processOrders); - return Object.freeze(promise); + + // Don't freeze promise because Bluebird expects it to be mutable. + return promise; }, slice: (start, end = Infinity) => { @@ -333,7 +335,8 @@ const Channel = function(length = 0) { setImmediate(processOrders); } - return Object.freeze(promise); + // Don't freeze promise because Bluebird expects it to be mutable. + return promise; }, writeOnly: () => writeOnly diff --git a/test/index.js b/test/index.js index 63693e4..53eb6f3 100644 --- a/test/index.js +++ b/test/index.js @@ -314,12 +314,6 @@ describe(`Channel object`, function() { await channel.push(0, 1, 2); }, new Error(`Can't push more than one value at a time.`)); }); - - it(`returns a frozen promise`, function() { - assert.throws(() => { - Channel().push(0).frozen = false; - }); - }); }); it(`readOnly`, async function() { @@ -375,12 +369,6 @@ describe(`Channel object`, function() { assert.equal(await channel.shift(), 0); }); - - it(`returns a frozen promise`, function() { - assert.throws(() => { - Channel().shift().frozen = false; - }); - }); }); describe(`slice`, function() {