Skip to content

Commit

Permalink
test: add subscribeWith tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Mar 1, 2020
1 parent 95b1fc1 commit 20354a4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/util/subscribeWith-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { expect } from 'chai';
import { of, Subscriber } from 'rxjs';
import { subscribeWith } from 'rxjs/internal/util/subscribeWith';
import { asInteropObservable, asInteropSubscriber } from '../helpers/interop-helper';

describe('subscribeToResult', () => {
it('should return the subscriber for interop observables', () => {
const subscriber = new Subscriber<number>();
const subscription = subscribeWith(asInteropObservable(of(42)), subscriber);
expect(subscription).to.equal(subscriber);
});

it('should return the subscriber for interop subscribers', () => {
const subscriber = asInteropSubscriber(new Subscriber<number>());
const subscription = subscribeWith(of(42), subscriber);
expect(subscription).to.equal(subscriber);
});
});

0 comments on commit 20354a4

Please sign in to comment.