Skip to content

Commit

Permalink
Add mergeWith (#5252)
Browse files Browse the repository at this point in the history
* feat(mergeWith): add mergeWith

* test(mergeWith): update tests
  • Loading branch information
benlesh authored Jan 22, 2020
1 parent 6d7b146 commit baf1442
Show file tree
Hide file tree
Showing 9 changed files with 503 additions and 389 deletions.
13 changes: 13 additions & 0 deletions spec-dtslint/operators/mergeWith-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { mergeWith } from 'rxjs/operators';
import { a$, b$, c$, d$, e$, f$, g$, h$} from '../helpers';

it('should accept N args', () => {
const r0 = a$.pipe(mergeWith()); // $ExpectType Observable<A>
const r1 = a$.pipe(mergeWith(b$)); // $ExpectType Observable<A | B>
const r2 = a$.pipe(mergeWith(b$, c$)); // $ExpectType Observable<A | B | C>
const r3 = a$.pipe(mergeWith(b$, c$, d$)); // $ExpectType Observable<A | B | C | D>
const r4 = a$.pipe(mergeWith(b$, c$, d$, e$)); // $ExpectType Observable<A | B | C | D | E>
const r5 = a$.pipe(mergeWith(b$, c$, d$, e$, f$)); // $ExpectType Observable<A | B | C | D | E | F>
const r6 = a$.pipe(mergeWith(b$, c$, d$, e$, f$, g$)); // $ExpectType Observable<A | B | C | D | E | F | G>
const r7 = a$.pipe(mergeWith(b$, c$, d$, e$, f$, g$, h$)); // $ExpectType Observable<A | B | C | D | E | F | G | H>
});
23 changes: 23 additions & 0 deletions spec/operators/merge-legacy-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { merge } from 'rxjs/operators';
import { queueScheduler, of } from 'rxjs';
import { expect } from 'chai';

describe('merge (legacy)', () => {
it('should merge an immediately-scheduled source with an immediately-scheduled second', done => {
const a = of(1, 2, 3, queueScheduler);
const b = of(4, 5, 6, 7, 8, queueScheduler);
const r = [1, 2, 4, 3, 5, 6, 7, 8];

a.pipe(merge(b, queueScheduler)).subscribe(
val => {
expect(val).to.equal(r.shift());
},
x => {
done(new Error('should not be called'));
},
() => {
done();
}
);
});
});
302 changes: 0 additions & 302 deletions spec/operators/merge-spec.ts

This file was deleted.

Loading

0 comments on commit baf1442

Please sign in to comment.