-
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.
Merge branch 'test-subscriber-observer-instance' of https://github.co…
…m/oscarlorentzon/rxjs into oscarlorentzon-test-subscriber-observer-instance
- Loading branch information
Showing
3 changed files
with
116 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
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
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,28 @@ | ||
import {expect} from 'chai'; | ||
import {toSubscriber} from '../../dist/cjs/util/toSubscriber'; | ||
|
||
describe('toSubscriber', () => { | ||
it('should not be closed when other subscriber created with no arguments completes', () => { | ||
let sub1 = toSubscriber(); | ||
let sub2 = toSubscriber(); | ||
|
||
sub2.complete(); | ||
|
||
expect(sub1.closed).to.be.false; | ||
expect(sub2.closed).to.be.true; | ||
}); | ||
|
||
it('should not be closed when other subscriber created with same observer instance completes', () => { | ||
let observer = { | ||
next: function () { /*noop*/ } | ||
}; | ||
|
||
let sub1 = toSubscriber(observer); | ||
let sub2 = toSubscriber(observer); | ||
|
||
sub2.complete(); | ||
|
||
expect(sub1.closed).to.be.false; | ||
expect(sub2.closed).to.be.true; | ||
}); | ||
}); |