Skip to content

Commit d95c3a9

Browse files
author
John Gilbert
committed
add-scheduler-support
1 parent 79e8a81 commit d95c3a9

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

test/unit/sinks/scheduler.test.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import 'mocha';
2+
import { expect } from 'chai';
3+
import sinon from 'sinon';
4+
import _ from 'highland';
5+
6+
import { scheduleEvent } from '../../../src/sinks/scheduler';
7+
8+
import Connector from '../../../src/connectors/scheduler';
9+
10+
describe('sinks/scheduler.js', () => {
11+
afterEach(sinon.restore);
12+
13+
it('should schedule', (done) => {
14+
const stub = sinon.stub(Connector.prototype, 'schedule').resolves({});
15+
16+
const uows = [{
17+
scheduleRequest: {
18+
X: 'y',
19+
},
20+
}];
21+
22+
_(uows)
23+
.through(scheduleEvent())
24+
.collect()
25+
.tap((collected) => {
26+
// console.log(JSON.stringify(collected, null, 2));
27+
28+
expect(stub).to.have.been.calledWith({
29+
X: 'y',
30+
});
31+
32+
expect(collected.length).to.equal(1);
33+
expect(collected[0]).to.deep.equal({
34+
scheduleRequest: {
35+
X: 'y',
36+
},
37+
scheduleResponse: {},
38+
});
39+
})
40+
.done(done);
41+
});
42+
});

0 commit comments

Comments
 (0)