-
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.
fix(buffer): do not emit empty buffer when completes
- do not emit empty buffer when observable completes - update test spec to use marble test scheduler
- Loading branch information
Showing
2 changed files
with
12 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
/* globals describe, it, expect */ | ||
/* globals describe, it, expect, expectObservable, hot */ | ||
var Rx = require('../../dist/cjs/Rx'); | ||
var Observable = Rx.Observable; | ||
|
||
describe('Observable.prototype.buffer', function () { | ||
it('should emit buffers that close and reopen', function (done) { | ||
var expected = [ | ||
[0, 1, 2], | ||
[3, 4, 5], | ||
[6, 7, 8] | ||
]; | ||
Observable.interval(100) | ||
.buffer(Observable.interval(320)) | ||
.take(3) | ||
.subscribe(function (w) { | ||
expect(w).toEqual(expected.shift()) | ||
}, null, done); | ||
}, 2000); | ||
it('should emit buffers that close and reopen', function () { | ||
var e1 = hot('-a-b-c-d-e-f-g-h-i-|'); | ||
var expected = '-----x-----y-----z-|'; | ||
var interval = hot('-----1-----2-----3-|'); | ||
|
||
expectObservable(e1.buffer(interval)).toBe(expected, {x: ['a','b','c'], y: ['d','e','f'], z: ['g','h','i']}); | ||
}); | ||
}); |
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