-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(node): add test for multiple copies of rxjs error
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
rm -rf node-tests/node_modules/ | ||
|
||
mkdir -p node-tests/node_modules/rxjs | ||
mkdir -p node-tests/node_modules/rxjs1 | ||
|
||
cp -R dist/package/. node-tests/node_modules/rxjs | ||
cp -R dist/package/. node-tests/node_modules/rxjs1 | ||
|
||
{ | ||
node node-tests/test.js | ||
# node --inspect-brk node-tests/test.js | ||
} || { | ||
echo 'TEST FAILED' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
var rxjs = require('rxjs'); | ||
var rxjs1 = require('rxjs1'); | ||
var mergeMap = require('rxjs/operators').mergeMap; | ||
var mergeMap1 = require('rxjs1/operators').mergeMap; | ||
|
||
var of = rxjs.of; | ||
var of1 = rxjs1.of; | ||
var from1 = rxjs1.from; | ||
|
||
var actual = []; | ||
var expected = [1]; | ||
|
||
var id = setTimeout(function () { | ||
throw new Error('TIMEOUT: Observable did not complete'); | ||
}, 200); | ||
|
||
of1(0).pipe( | ||
mergeMap1(function () { return of(x); }), | ||
mergeMap(function () { return from1(Promise.resolve(1)); }) | ||
).subscribe({ | ||
next: function (value) { actual.push(value); }, | ||
error: function () { | ||
throw new Error('should not error'); | ||
}, | ||
complete: function () { | ||
if (actual.length !== expected.length || actual[0] !== expected[0] || actual[1] !== expected[1]) { | ||
throw new Error(actual + ' does not equal ' + expected); | ||
} else { | ||
clearTimeout(id); | ||
console.log('TEST PASSED'); | ||
} | ||
}, | ||
}); |