Skip to content

Commit

Permalink
test(mapTo): add test for mapTo expected behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
TylorS authored and Andre Medeiros committed Mar 28, 2016
1 parent 4514dbb commit 9f1af1f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/operator/mapTo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import xs from '../../src/index';
import * as assert from 'assert';

describe('Stream.prototype.mapTo', () => {
it('should transform events to a constant value', (done) => {
const stream = xs.interval(100).mapTo(10);
const expected = [10, 10, 10];
let listener = {
next: (x: number) => {
assert.equal(x, expected.shift());
if (expected.length === 0) {
stream.removeListener(listener);
done();
}
},
error: done.fail,
complete: done.fail,
};
stream.addListener(listener);
});
});

0 comments on commit 9f1af1f

Please sign in to comment.