File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,6 @@ var tick = require('next-tick');
7
7
var once = require ( 'once' ) ;
8
8
var exhaust = require ( 'stream-exhaust' ) ;
9
9
10
- function noop ( ) { }
11
-
12
10
var eosConfig = {
13
11
error : false
14
12
} ;
@@ -37,6 +35,14 @@ function asyncDone(fn, cb){
37
35
function asyncRunner ( ) {
38
36
var result = domainBoundFn ( done ) ;
39
37
38
+ function onNext ( state ) {
39
+ onNext . state = state ;
40
+ }
41
+
42
+ function onCompleted ( ) {
43
+ return onSuccess ( onNext . state ) ;
44
+ }
45
+
40
46
if ( result && typeof result . on === 'function' ) {
41
47
// assume node stream
42
48
d . add ( result ) ;
@@ -46,7 +52,7 @@ function asyncDone(fn, cb){
46
52
47
53
if ( result && typeof result . subscribe === 'function' ) {
48
54
// assume RxJS observable
49
- result . subscribe ( noop , onError , onSuccess ) ;
55
+ result . subscribe ( onNext , onError , onCompleted ) ;
50
56
return ;
51
57
}
52
58
Original file line number Diff line number Diff line change @@ -30,11 +30,7 @@ describe('observables', function(){
30
30
} ) ;
31
31
} ) ;
32
32
33
- /*
34
- Currently, we don't support values returned from observables.
35
- This keeps the code simpler.
36
- */
37
- it . skip ( 'should handle a finished observable with value' , function ( done ) {
33
+ it ( 'should handle a finished observable with value' , function ( done ) {
38
34
asyncDone ( successValue , function ( err , result ) {
39
35
expect ( result ) . to . equal ( 42 ) ;
40
36
done ( err ) ;
You can’t perform that action at this time.
0 commit comments