Skip to content

Commit

Permalink
test(groupBy): add missing basic test cases
Browse files Browse the repository at this point in the history
Add basic/corner test cases for groupBy, such as never, empty, etc.
  • Loading branch information
Andre Medeiros authored and benlesh committed Oct 13, 2015
1 parent c61adb1 commit 8bfb23e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions spec/operators/groupBy-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,45 @@ describe('Observable.prototype.groupBy()', function () {
}, null, done);
});

it('should handle an empty Observable', function () {
var e1 = cold('|');
var expected = '|';

var source = e1
.groupBy(function (val) { return val.toLowerCase().trim(); });
expectObservable(source).toBe(expected);
});

it('should handle a never Observable', function () {
var e1 = cold('-');
var expected = '-';

var source = e1
.groupBy(function (val) { return val.toLowerCase().trim(); });
expectObservable(source).toBe(expected);
});

it('should handle a just-throw Observable', function () {
var e1 = cold('#');
var expected = '#';

var source = e1
.groupBy(function (val) { return val.toLowerCase().trim(); });
expectObservable(source).toBe(expected);
});

it('should handle an Observable with a single value', function () {
var values = { a: ' foo' };
var e1 = hot('^--a--|', values);
var expected = '---g--|';
var g = cold( 'a--|', values);
var expectedValues = { g: g };

var source = e1
.groupBy(function (val) { return val.toLowerCase().trim(); });
expectObservable(source).toBe(expected, expectedValues);
});

it('should group values with a key comparer', function () {
var values = {
a: ' foo',
Expand Down

0 comments on commit 8bfb23e

Please sign in to comment.