Skip to content

Commit

Permalink
test: add failing test for ReactiveX#5233
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Jan 15, 2020
1 parent 56e7ceb commit 55fbe58
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/observables/dom/fetch-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,25 @@ describe('fromFetch', () => {
expect(mockFetch.calls[0].init.signal.aborted).to.be.true;
});

it('should not immediately abort repeat subscribers', () => {
const fetch$ = fromFetch('/foo');
expect(mockFetch.calls.length).to.equal(0);
expect(MockAbortController.created).to.equal(0);
let subscription = fetch$.subscribe();
expect(MockAbortController.created).to.equal(1);
expect(mockFetch.calls[0].init.signal.aborted).to.be.false;

subscription.unsubscribe();
expect(mockFetch.calls[0].init.signal.aborted).to.be.true;

subscription = fetch$.subscribe();
expect(MockAbortController.created).to.equal(2);
expect(mockFetch.calls[1].init.signal.aborted).to.be.false;

subscription.unsubscribe();
expect(mockFetch.calls[1].init.signal.aborted).to.be.true;
});

it('should allow passing of init object', done => {
const fetch$ = fromFetch('/foo', {method: 'HEAD'});
fetch$.subscribe({
Expand Down

0 comments on commit 55fbe58

Please sign in to comment.