UNPKG

394 BJavaScriptView Raw
1
2const assert = require('assert');
3const co = require('../cockrel');
4
5
6
7describe("Plugin: map", function() {
8
9
10 it("can execute a sub-chain over an array", function(done) {
11
12 co.map(co.do((data) => { return data * data; }))
13 .do(check)
14 .begin([1,2]);
15
16
17 function check(data) {
18 assert.equal(data[0], 1);
19 assert.equal(data[1], 4);
20 done();
21 }
22
23 });
24
25
26});
27
28