Skip to content

Commit

Permalink
Merge pull request #38 from kwonoj/feat-advanceframe
Browse files Browse the repository at this point in the history
feat(advanceto): implement advanceTo interface  …
  • Loading branch information
kwonoj authored Aug 27, 2017
2 parents 9d98836 + 717761a commit 2020c29
Show file tree
Hide file tree
Showing 11 changed files with 283 additions and 62 deletions.
4 changes: 2 additions & 2 deletions spec/assert/constructObservableMarble-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ describe('constructObservableMarble', () => {
expect(marble).to.equal(e);
});

it('should craet marble with higher order obsrevables', () => {
const scheduler = new TestScheduler();
it('should create marble with higher order obsrevables', () => {
const scheduler = new TestScheduler(false, 1, 1000);

const s = '--a--b--|';
const a = scheduler.createHotObservable('--1--2--|');
Expand Down
10 changes: 10 additions & 0 deletions spec/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ describe('rxSandbox', () => {
expect(v).to.deep.equal(expected);
});

it('should able to create instance with custom maxFrame', () => {
const sandbox = idx.rxSandbox;

const { e } = sandbox.create(false, 1, 5);
const v = e('--a------|');
const expected = [idx.next(2, 'a')];

expect(v).to.deep.equal(expected);
});

it('should able to create expected message values', () => {
const { e } = idx.rxSandbox.create();

Expand Down
20 changes: 19 additions & 1 deletion spec/marbles/parseObservableMarble-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ describe('parseObservableMarble', () => {
expect(messages).to.deep.equal(expected);
});

it('should parse timeframe with maxFrame', () => {
const marble = '--a------b--|';

const messages = parseObservableMarble(marble, null, null, false, 1, 5);
const expected = [next(2, 'a')];

expect(messages).to.deep.equal(expected);
});

it('should flatten custom value with inner observable when specified', () => {
const marble = '----a--b--';
const aMessages = [next(1, '1'), next(2, '2')];
Expand Down Expand Up @@ -68,6 +77,15 @@ describe('parseObservableMarble', () => {
expect(messages).to.deep.equal(expected);
});

it('should support custom timeframe value with maxFrame', () => {
const marble = '--a------b--|';

const messages = parseObservableMarble(marble, null, null, false, 10, 50);
const expected = [next(20, 'a')];

expect(messages).to.deep.equal(expected);
});

it('should parse value literal', () => {
const marble = 'x';

Expand Down Expand Up @@ -179,7 +197,7 @@ describe('parseObservableMarble', () => {
});

it('should able to flatten inner observable', () => {
const scheduler = new TestScheduler();
const scheduler = new TestScheduler(false, 1, 1000);

const marble = ' --a--|';
const inner = scheduler.createColdObservable('---1--');
Expand Down
18 changes: 18 additions & 0 deletions spec/marbles/parseSubscriptionMarble-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ describe('parseSubscriptionMarble', () => {
expect(subscription).to.deep.equal(expected);
});

it('should parse subscription with unsubscription with maxFrame', () => {
const marble = '--^-----!';

const subscription = parseSubscriptionMarble(marble, 1, 5);
const expected = subscribe(2, Number.POSITIVE_INFINITY);

expect(subscription).to.deep.equal(expected);
});

it('should support custom timeframe value', () => {
const marble = '--^-----!';

Expand All @@ -39,6 +48,15 @@ describe('parseSubscriptionMarble', () => {
expect(subscription).to.deep.equal(expected);
});

it('should support custom timeframe value with maxFrame', () => {
const marble = '--^-----!';

const subscription = parseSubscriptionMarble(marble, 10, 50);
const expected = subscribe(20, Number.POSITIVE_INFINITY);

expect(subscription).to.deep.equal(expected);
});

it('should allow whitespace', () => {
const marble = '-- ^ -----!';

Expand Down
Loading

0 comments on commit 2020c29

Please sign in to comment.