Skip to content

Commit

Permalink
test(TestScheduler): add test for subscription marbles parser (#5867)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakovljevic-mladen authored Oct 30, 2020
1 parent f1ec819 commit aacb99c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion spec/schedulers/TestScheduler-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,20 @@ describe('TestScheduler', () => {
expect(result.unsubscribedFrame).to.equal(70);
});

it('should suppport time progression syntax when runMode=true', () => {
it('should support time progression syntax when runMode=true', () => {
const runMode = true;
const result = TestScheduler.parseMarblesAsSubscriptions('10.2ms ^ 1.2s - 1m !', runMode);
expect(result.subscribedFrame).to.equal(10.2);
expect(result.unsubscribedFrame).to.equal(10.2 + 10 + (1.2 * 1000) + 10 + (1000 * 60));
});

it('should throw if found more than one subscription point', () => {
expect(() => TestScheduler.parseMarblesAsSubscriptions('---^-^-!-')).to.throw();
});

it('should throw if found more than one unsubscription point', () => {
expect(() => TestScheduler.parseMarblesAsSubscriptions('---^---!-!')).to.throw();
});
});

describe('createTime()', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/testing/TestScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class TestScheduler extends VirtualTimeScheduler {
break;
case '!':
if (unsubscriptionFrame !== Infinity) {
throw new Error('found a second subscription point \'^\' in a ' +
throw new Error('found a second unsubscription point \'!\' in a ' +
'subscription marble diagram. There can only be one.');
}
unsubscriptionFrame = groupStart > -1 ? groupStart : frame;
Expand Down

0 comments on commit aacb99c

Please sign in to comment.