Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pipe): add piped operators #75

Merged
merged 112 commits into from
Oct 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
94cad27
feat(pipe): add piped operators
mattpodwysocki Oct 10, 2017
bfec28e
Merge branch 'master' of https://github.com/ReactiveX/IxJS into pipe
mattpodwysocki Oct 17, 2017
336f46f
feat(pipe): add through concat
mattpodwysocki Oct 17, 2017
cbb309d
feat(pipe): merge from master
mattpodwysocki Oct 17, 2017
468d246
Merge branch 'master' of https://github.com/ReactiveX/IxJS into pipe
mattpodwysocki Oct 23, 2017
007faea
Merge branch 'master' of https://github.com/ReactiveX/IxJS into pipe
mattpodwysocki Oct 23, 2017
a7e7ad7
feat(pipe): add through defaultIfEmpty
mattpodwysocki Oct 23, 2017
152fc06
feat(pipe): add through delay
mattpodwysocki Oct 23, 2017
8b071ad
feat(pipe): add through delayEach
mattpodwysocki Oct 23, 2017
4a6b817
feat(pipe): add through distinct
mattpodwysocki Oct 23, 2017
29f7eb8
feat(pipe): add through distinctUntilChanged
mattpodwysocki Oct 23, 2017
c19313d
feat(pipe): add through doWhile
mattpodwysocki Oct 23, 2017
25c6f21
feat(pipe): add through endwith
mattpodwysocki Oct 23, 2017
9d099e1
feat(pipe): add through except
mattpodwysocki Oct 23, 2017
883b776
feat(pipe): add through expand
mattpodwysocki Oct 23, 2017
45fddaf
feat(pipe): add through filter
mattpodwysocki Oct 23, 2017
2fcd230
feat(pipe): add through finally
mattpodwysocki Oct 24, 2017
60fde4b
feat(pipe): add through flatmap
mattpodwysocki Oct 24, 2017
9c43e9d
feat(pipe): add through flatten
mattpodwysocki Oct 24, 2017
dcac250
feat(pipe): add through groupby
mattpodwysocki Oct 24, 2017
3503a6d
feat(pipe): add through groupjoin
mattpodwysocki Oct 24, 2017
613c50e
feat(pipe): add through ignoreelements
mattpodwysocki Oct 24, 2017
94892c7
feat(pipe): add through innerjoin
mattpodwysocki Oct 24, 2017
caf1bcb
feat(pipe): add through intersect
mattpodwysocki Oct 24, 2017
fad4faa
feat(pipe): add through map
mattpodwysocki Oct 24, 2017
c9fc03b
feat(pipe): add through memoize
mattpodwysocki Oct 24, 2017
4fcbb0f
feat(pipe): add through merge
mattpodwysocki Oct 24, 2017
7fdf0b8
feat(pipe): add through mergeAll
mattpodwysocki Oct 24, 2017
3e55e4f
feat(pipe): add through minby
mattpodwysocki Oct 24, 2017
3de02e0
feat(pipe): add through onerrorresumenext
mattpodwysocki Oct 24, 2017
7b2bf03
feat(pipe): add through pairwise
mattpodwysocki Oct 24, 2017
7cb72c5
feat(pipe): add through pluck
mattpodwysocki Oct 24, 2017
ae15b1c
Merge branch 'master' of https://github.com/ReactiveX/IxJS into pipe
mattpodwysocki Oct 24, 2017
753c1cb
feat(pipe): add through publish
mattpodwysocki Oct 24, 2017
bddb837
feat(pipe): add through repeat
mattpodwysocki Oct 24, 2017
baf7996
Merge branch 'master' of https://github.com/ReactiveX/IxJS into pipe
mattpodwysocki Oct 24, 2017
c908085
feat(pipe): add through retry
mattpodwysocki Oct 24, 2017
da5f342
feat(pipe): add through reverse
mattpodwysocki Oct 24, 2017
8f321e1
feat(pipe): add through scan
mattpodwysocki Oct 24, 2017
6e1f577
feat(pipe): add through scanRight
mattpodwysocki Oct 24, 2017
b52a2d1
feat(pipe): add through share
mattpodwysocki Oct 24, 2017
b1f1365
feat(pipe): add through skip
mattpodwysocki Oct 24, 2017
fb566f3
feat(pipe): add through skipLast
mattpodwysocki Oct 24, 2017
b8e0844
feat(pipe): add through skipUntil
mattpodwysocki Oct 24, 2017
efefa91
feat(pipe): add through skipWhile
mattpodwysocki Oct 24, 2017
338f5e4
feat(pipe): add through slice
mattpodwysocki Oct 24, 2017
0d8a61a
feat(pipe): add through startwith
mattpodwysocki Oct 24, 2017
60dabc8
feat(pipe): add through take
mattpodwysocki Oct 24, 2017
6ded104
feat(pipe): add through takelast
mattpodwysocki Oct 24, 2017
30644d5
feat(pipe): add through takeuntil
mattpodwysocki Oct 24, 2017
977efa2
feat(pipe): add through takewhile
mattpodwysocki Oct 24, 2017
010b959
feat(pipe): add through tap
mattpodwysocki Oct 24, 2017
f44726d
feat(pipe): add through throttle
mattpodwysocki Oct 24, 2017
829e89e
feat(pipe): add through timeinterval
mattpodwysocki Oct 24, 2017
bae08b4
feat(pipe): add through timeout
mattpodwysocki Oct 24, 2017
b42c22e
feat(pipe): add through timestamp
mattpodwysocki Oct 24, 2017
236819d
feat(pipe): add through union
mattpodwysocki Oct 24, 2017
0f497af
feat(pipe): add through buffer
mattpodwysocki Oct 25, 2017
f1b9e48
feat(pipe): add through catch
mattpodwysocki Oct 25, 2017
d03709f
feat(pipe): add through catchWith
mattpodwysocki Oct 25, 2017
9096bbc
feat(pipe): add through concat
mattpodwysocki Oct 25, 2017
01eab69
feat(pipe): add through concatall
mattpodwysocki Oct 25, 2017
3aa1000
feat(pipe): add through defaultifempty
mattpodwysocki Oct 25, 2017
4575fb7
feat(pipe): add through distinct
mattpodwysocki Oct 25, 2017
8aee912
feat(pipe): add through distinctuntilchanged
mattpodwysocki Oct 25, 2017
b1ee24c
feat(pipe): add through dowhile
mattpodwysocki Oct 25, 2017
35d84e9
feat(pipe): add through endwith
mattpodwysocki Oct 25, 2017
b1cf9e5
feat(pipe): add through except
mattpodwysocki Oct 25, 2017
e63cf1a
feat(pipe): add through expand
mattpodwysocki Oct 25, 2017
da38818
feat(pipe): add through filter
mattpodwysocki Oct 25, 2017
80f029f
feat(pipe): add through finally
mattpodwysocki Oct 25, 2017
ecf76d8
feat(pipe): add through flatmap
mattpodwysocki Oct 25, 2017
1c90a65
feat(pipe): add through flatten
mattpodwysocki Oct 25, 2017
d534118
feat(pipe): add through groupjoin
mattpodwysocki Oct 25, 2017
70fc256
feat(pipe): add through ignorelements
mattpodwysocki Oct 25, 2017
c8989cd
feat(pipe): add through innerjoin
mattpodwysocki Oct 25, 2017
438b5c4
feat(pipe): add through intersect
mattpodwysocki Oct 25, 2017
000fbfe
feat(pipe): add through map
mattpodwysocki Oct 25, 2017
53ce45a
feat(pipe): add through maxby
mattpodwysocki Oct 25, 2017
16be746
feat(pipe): add through memoie
mattpodwysocki Oct 25, 2017
f628703
feat(pipe): add through minby
mattpodwysocki Oct 25, 2017
b1c39ac
feat(pipe): add through onerrorresumenext
mattpodwysocki Oct 25, 2017
b46c7f2
feat(pipe): add through pairwise
mattpodwysocki Oct 25, 2017
ab8ece6
feat(pipe): add through pluck
mattpodwysocki Oct 25, 2017
75f971e
feat(pipe): add through publish
mattpodwysocki Oct 25, 2017
054ae84
feat(pipe): add through repeat
mattpodwysocki Oct 25, 2017
b4c2b7a
feat(pipe): add through retry
mattpodwysocki Oct 25, 2017
b9a0b3c
feat(pipe): add through reverse
mattpodwysocki Oct 25, 2017
b4bfe6d
feat(pipe): add through scan
mattpodwysocki Oct 25, 2017
15a8eb3
feat(pipe): add through scanright
mattpodwysocki Oct 25, 2017
8164e88
feat(pipe): add through share
mattpodwysocki Oct 25, 2017
1b1e116
feat(pipe): add through skip
mattpodwysocki Oct 25, 2017
d148ba3
feat(pipe): add through skiplast
mattpodwysocki Oct 25, 2017
610c39f
feat(pipe): add through skipwhile
mattpodwysocki Oct 25, 2017
24e87ae
feat(pipe): add through slice
mattpodwysocki Oct 25, 2017
2e76d23
feat(pipe): add through startwith
mattpodwysocki Oct 25, 2017
7c5667c
feat(pipe): add through take
mattpodwysocki Oct 25, 2017
298bcc5
feat(pipe): add through takelast
mattpodwysocki Oct 25, 2017
d1c99b5
feat(pipe): add through takewhile
mattpodwysocki Oct 25, 2017
d9fe714
feat(pipe): add through tap
mattpodwysocki Oct 25, 2017
37e15af
feat(pipe): add through union
mattpodwysocki Oct 25, 2017
3cb4080
feat(pipe): add through pipe
mattpodwysocki Oct 25, 2017
df6b7b9
feat(pipe): moving pipe and forEach to core
mattpodwysocki Oct 25, 2017
fec0e36
feat(pipe): adds of and from to base
mattpodwysocki Oct 26, 2017
88e0591
feat(pipe): fix build
mattpodwysocki Oct 26, 2017
aa84905
style(lint): update code lint friendly (#116)
kwonoj Oct 27, 2017
35773d7
feat(from): make from on non-iterables coerce to iterables (#117)
trxcllnt Oct 27, 2017
e05ec24
feat(pipe): add to __modules
mattpodwysocki Oct 28, 2017
2e147a7
feat(pipe): add to __modules
mattpodwysocki Oct 28, 2017
4ecff97
feat(pipe): adding piped tests
mattpodwysocki Oct 28, 2017
7cc833c
fix pipe exports (#119)
trxcllnt Oct 29, 2017
8e62fe4
test(helpers): disable missing pipe fn logging
trxcllnt Oct 29, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 9 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const { Observable, Scheduler, Subject, ReplaySubject } = require(`rxjs`);
const releasesRootDir = `targets`;
const knownTargets = [`es5`, `es2015`, `esnext`];
const knownModules = [`cjs`, `esm`, `cls`, `umd`];
const moduleFormatsToSkipCombosOf = { cls: true };
const metadataFiles = [`LICENSE`, `readme.md`, `CHANGELOG.md`];
const packageJSONFields = [
`version`, `license`, `description`,
Expand Down Expand Up @@ -272,7 +271,7 @@ const compileUglifyJS = ((cache, commonConfig) => memoizeTask(cache, function ug
compress: { unsafe: true, },
output: { comments: false, beautify: false },
mangle: { eval: true, safari10: true, // <-- Works around a Safari 10 bug: // https://github.com/mishoo/UglifyJS2/issues/1753
properties: { reserved }
properties: { reserved: [`configurable`, `enumerable`, ...reserved] }
}
},
})
Expand Down Expand Up @@ -462,9 +461,10 @@ function gulpConcurrent(tasks, concurrency = 'parallel') {
const buildConcurrent = (tasks) => () =>
gulpConcurrent(tasks)()
.concat(Observable
.defer(() => Observable
.merge(...knownTargets.map((target) =>
del(`${_dir(UMDSourceTargets[target], `cls`)}/**`)))));
.defer(() => modules.indexOf(`cls`) > -1 ?
Observable.empty() :
Observable.merge(...knownTargets.map((target) =>
del(`${_dir(target, `cls`)}/**`)))));

const testConcurrency = process.env.IS_APPVEYOR_CI ? 'series' : 'parallel';

Expand All @@ -479,7 +479,7 @@ function getTasks(name) {
if (targets.indexOf(`ts`) !== -1) tasks.push(`${name}:ts`);
if (targets.indexOf(`ix`) !== -1) tasks.push(`${name}:ix`);
for (const [target, format] of combinations(targets, modules)) {
if (format in moduleFormatsToSkipCombosOf) {
if (format === `cls` && (name === `test` || modules.indexOf(`cls`) === -1)) {
continue;
}
tasks.push(`${name}:${_task(target, format)}`);
Expand All @@ -495,10 +495,10 @@ function _dir(target, format) { return path.join(releasesRootDir, ...(!format ?

function* combinations(_targets, _modules) {

const targets = known(knownTargets, _targets || (_targets = [`all`]));
const modules = known(knownModules, _modules || (_modules = [`all`]));
const targets = known(knownTargets, _targets || [`all`]);
const modules = known(knownModules, _modules || [`all`]);

if (_targets[0] === `all` && _modules[0] === `all`) {
if (targets[0] === `all` && modules[0] === `all`) {
yield [`ts`, ``];
yield [`ix`, ``];
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"release": "./npm-release.sh",
"doc": "shx rm -rf ./doc && esdoc",
"commitmsg": "validate-commit-msg",
"lint:src": "tslint --fix --type-check -p tsconfig.json -c tslint.json \"src/**/*.ts\"",
"lint:spec": "tslint --fix --type-check -p spec/tsconfig.json -c tslint.json \"spec/**/*.ts\"",
"lint:src": "tslint --fix --project -p tsconfig.json -c tslint.json \"src/**/*.ts\"",
"lint:spec": "tslint --fix --project -p spec/tsconfig.json -c tslint.json \"spec/**/*.ts\"",
"prepublishOnly": "echo \"Error: do 'npm run release' instead of 'npm publish'\" && exit 1"
},
"author": "Matthew Podwysocki <matthewp@microsoft.com>",
Expand Down
16 changes: 15 additions & 1 deletion spec/Ix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ const targets = [`es5`, `es2015`, `esnext`];
const formats = [`cjs`, `esm`, `cls`, `umd`];

function throwInvalidImportError(name: string, value: string, values: string[]) {
throw new Error('Unrecognized ' + name + ' \'' + value + '\'. Please run tests with \'--' + name + ' <any of ' + values.join(', ') + '>\'');
throw new Error(
'Unrecognized ' +
name +
" '" +
value +
"'. Please run tests with '--" +
name +
' <any of ' +
values.join(', ') +
">'"
);
}

let modulePath = ``;
Expand All @@ -28,10 +38,14 @@ import { Iterable as Iterable_ } from '../src/Ix';
import { AsyncSink as AsyncSink_ } from '../src/Ix';
import { AsyncIterable as AsyncIterable_ } from '../src/Ix';
import { iterable as iterable_ } from '../src/Ix.internal';
import { iterablePipe as iterablePipe_ } from '../src/Ix.internal';
import { asynciterable as asynciterable_ } from '../src/Ix.internal';
import { asynciterablePipe as asynciterablePipe_ } from '../src/Ix.internal';

export let Iterable: typeof Iterable_ = Ix.Iterable;
export let AsyncSink: typeof AsyncSink_ = Ix.AsyncSink;
export let AsyncIterable: typeof AsyncIterable_ = Ix.AsyncIterable;
export let iterable: typeof iterable_ = IxInternal.iterable;
export let iterablePipe: typeof iterablePipe_ = IxInternal.iterablePipe;
export let asynciterable: typeof asynciterable_ = IxInternal.asynciterable;
export let asynciterablePipe: typeof asynciterablePipe_ = IxInternal.asynciterablePipe;
16 changes: 8 additions & 8 deletions spec/asynciterable-operators/average-spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as Ix from '../Ix';
import * as test from 'tape-async';
const { average } = Ix.asynciterable;
import { testOperator } from '../asynciterablehelpers';
const test = testOperator([Ix.asynciterable.average]);
const { empty } = Ix.asynciterable;
const { of } = Ix.asynciterable;
const { of } = Ix.AsyncIterable;

test('Iterable#average empty', async (t: test.Test) => {
test('Iterable#average empty', async (t, [average]) => {
const xs = empty<number>();
try {
await average(xs);
Expand All @@ -14,13 +14,13 @@ test('Iterable#average empty', async (t: test.Test) => {
t.end();
});

test('Iterable#average', async (t: test.Test) => {
test('Iterable#average', async (t, [average]) => {
const res = await average(of(1, 2, 3));
t.equal(res, 2);
t.end();
});

test('Iterable#average with selector empty', async (t: test.Test) => {
test('Iterable#average with selector empty', async (t, [average]) => {
const xs = empty<number>();
try {
await average(xs, async x => x * 2);
Expand All @@ -30,13 +30,13 @@ test('Iterable#average with selector empty', async (t: test.Test) => {
t.end();
});

test('Iterable#average with selector', async (t: test.Test) => {
test('Iterable#average with selector', async (t, [average]) => {
const res = await average(of(1, 2, 3), x => x * 2);
t.equal(res, 4);
t.end();
});

test('Iterable#average laws', async (t: test.Test) => {
test('Iterable#average laws', async (t, [average]) => {
const xs = of(1, 2, 3);
t.equal(await average(xs), await average(xs, x => x));
t.end();
Expand Down
14 changes: 7 additions & 7 deletions spec/asynciterable-operators/buffer-spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as Ix from '../Ix';
import * as test from 'tape-async';
const { buffer } = Ix.asynciterable;
import { testOperator } from '../asynciterablehelpers';
const test = testOperator([Ix.asynciterable.buffer]);
const { empty } = Ix.asynciterable;
const { range } = Ix.asynciterable;
const { sequenceEqual } = Ix.iterable;
const { toArray } = Ix.asynciterable;

test('AsyncIterable#buffer no skip non-full buffer', async t => {
test('AsyncIterable#buffer no skip non-full buffer', async (t, [buffer]) => {
const rng = range(0, 10);

const res = await toArray(buffer(rng, 3));
Expand All @@ -19,7 +19,7 @@ test('AsyncIterable#buffer no skip non-full buffer', async t => {
t.end();
});

test('AsyncIterable#buffer no skip all full', async t => {
test('AsyncIterable#buffer no skip all full', async (t, [buffer]) => {
const rng = range(0, 10);

const res = await toArray(buffer(rng, 5));
Expand All @@ -30,15 +30,15 @@ test('AsyncIterable#buffer no skip all full', async t => {
t.end();
});

test('AsyncIterable#buffer no skip empty buffer', async t => {
test('AsyncIterable#buffer no skip empty buffer', async (t, [buffer]) => {
const rng = empty<number>();

const res = await toArray(buffer(rng, 5));
t.equal(0, res.length);
t.end();
});

test('AsyncIterable#buffer skip non-full buffer', async t => {
test('AsyncIterable#buffer skip non-full buffer', async (t, [buffer]) => {
const rng = range(0, 10);

const res = await toArray(buffer(rng, 3, 2));
Expand All @@ -52,7 +52,7 @@ test('AsyncIterable#buffer skip non-full buffer', async t => {
t.end();
});

test('AsyncIterable#buffer skip full buffer', async t => {
test('AsyncIterable#buffer skip full buffer', async (t, [buffer]) => {
const rng = range(0, 10);

const res = await toArray(buffer(rng, 3, 4));
Expand Down
10 changes: 5 additions & 5 deletions spec/asynciterable-operators/catch-spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as Ix from '../Ix';
import * as test from 'tape-async';
const { _catch } = Ix.asynciterable;
import { testOperator } from '../asynciterablehelpers';
const test = testOperator([Ix.asynciterable._catch]);
const { concat } = Ix.asynciterable;
const { range } = Ix.asynciterable;
const { sequenceEqual } = Ix.asynciterable;
const { _throw } = Ix.asynciterable;
import { hasNext } from '../asynciterablehelpers';

test('AsyncIterable#catch with no errors', async t => {
test('AsyncIterable#catch with no errors', async (t, [_catch]) => {
const res = _catch(range(0, 5), range(5, 5));
t.true(await sequenceEqual(res, range(0, 5)));
t.end();
});

test('AsyncIterable#catch with concat error', async t => {
test('AsyncIterable#catch with concat error', async (t, [_catch]) => {
const res = _catch(
concat(range(0, 5), _throw(new Error())),
range(5, 5)
Expand All @@ -23,7 +23,7 @@ test('AsyncIterable#catch with concat error', async t => {
t.end();
});

test('AsyncIterable#catch still throws', async t => {
test('AsyncIterable#catch still throws', async (t, [_catch]) => {
const e1 = new Error();
const er1 = _throw(e1);

Expand Down
22 changes: 15 additions & 7 deletions spec/asynciterable-operators/catchwith-spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import * as Ix from '../Ix';
import * as test from 'tape-async';
const { catchWith } = Ix.asynciterable;
const { of } = Ix.asynciterable;
import { testOperator } from '../asynciterablehelpers';
const test = testOperator([Ix.asynciterable.catchWith]);
const { of } = Ix.AsyncIterable;
const { range } = Ix.asynciterable;
const { sequenceEqual } = Ix.asynciterable;
const { single } = Ix.asynciterable;
const { _throw } = Ix.asynciterable;

test('AsyncIterable#catchWith error catches', async t => {
test('AsyncIterable#catchWith error catches', async (t, [catchWith]) => {
const err = new Error();
const res = await single(catchWith(_throw(err), async e => { t.same(err, e); return of(42); }));
const res = await single(
catchWith(_throw(err), async e => {
t.same(err, e);
return of(42);
})
);
t.equal(42, res);
t.end();
});

test('AsyncIterable#catchWith no error misses', async t => {
test('AsyncIterable#catchWith no error misses', async (t, [catchWith]) => {
const xs = range(0, 10);
const res = catchWith(xs, async e => { t.fail(); return of(42); });
const res = catchWith(xs, async e => {
t.fail();
return of(42);
});
t.true(await sequenceEqual(res, xs));
t.end();
});
6 changes: 3 additions & 3 deletions spec/asynciterable-operators/chain-spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as Ix from '../Ix';
import * as test from 'tape-async';
import { testOperator } from '../asynciterablehelpers';
const test = testOperator([Ix.asynciterable.chain]);
const { empty } = Ix.asynciterable;
const { chain } = Ix.asynciterable;
import { noNext } from '../asynciterablehelpers';

test('Itearble#chain calls function immediately', async t => {
test('Itearble#chain calls function immediately', async (t, [chain]) => {
let called = false;
const xs = chain(empty<number>(), x => { called = true; return x; });
t.true(called);
Expand Down
29 changes: 13 additions & 16 deletions spec/asynciterable-operators/concat-spec.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
import * as Ix from '../Ix';
import * as test from 'tape-async';
const { concat } = Ix.asynciterable;
const { concatAll } = Ix.asynciterable;
import { testOperator } from '../asynciterablehelpers';
const testConcat = testOperator([Ix.asynciterable.concat]);
const testConcatAll = testOperator([Ix.asynciterable.concatAll]);
const { map } = Ix.asynciterable;
const { of } = Ix.asynciterable;
const { of } = Ix.AsyncIterable;
const { range } = Ix.asynciterable;
const { sequenceEqual } = Ix.asynciterable;
const { tap } = Ix.asynciterable;

test('AsyncIterable#concat concatAll behavior', async t => {
testConcatAll('AsyncIterable#concat concatAll behavior', async (t, [concatAll]) => {
const res = concatAll(of(of(1, 2, 3), of(4, 5)));
t.true(await sequenceEqual(res, of(1, 2, 3, 4, 5)));
t.end();
});

test('Iterable#concat concatAll order of effects', async t => {
testConcatAll('Iterable#concat concatAll order of effects', async (t, [concatAll]) => {
let i = 0;
const xss = tap(map(range(0, 3), x => range(0, x + 1)), { next: async () => { ++i; } });
const xss = tap(map(range(0, 3), x => range(0, x + 1)), {
next: async () => {
++i;
}
});
const res = map(concatAll(xss), x => i + ' - ' + x);

t.true(await sequenceEqual(res, of(
'1 - 0',
'2 - 0',
'2 - 1',
'3 - 0',
'3 - 1',
'3 - 2'
)));
t.true(await sequenceEqual(res, of('1 - 0', '2 - 0', '2 - 1', '3 - 0', '3 - 1', '3 - 2')));
t.end();
});

test('AsyncIterable#concat behavior', async t => {
testConcat('AsyncIterable#concat behavior', async (t, [concat]) => {
const res = concat(of(1, 2, 3), of(4, 5));
t.true(await sequenceEqual(res, of(1, 2, 3, 4, 5)));
t.end();
Expand Down
Loading