diff --git a/lib/index.js b/lib/index.js index ac6e97b..ca3913d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -197,14 +197,14 @@ const Channel = function(length = 0) { }, map: (callbackfn, thisArg) => { - const output = Channel(length); + const output = Channel(); (async () => { await readOnly.forEach(value => output.push(callbackfn.call(thisArg, value)) ); - output.close(); + await output.close(); })(); return output; diff --git a/test/index.js b/test/index.js index b46ee81..8ae24c7 100644 --- a/test/index.js +++ b/test/index.js @@ -271,7 +271,6 @@ describe(`Channel object`, function() { await channel.push(`c`); await channel.close(); const mapped = channel.map(value => value.toUpperCase()); - assert.equal(mapped.length, channel.length); assert.deepEqual(await mapped.values(), [`A`, `B`, `C`]); });