File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments