Skip to content

Commit

Permalink
Merge pull request #39 from kwonoj/release-0.0.5
Browse files Browse the repository at this point in the history
docs(readme): update advanceTo documentation
  • Loading branch information
kwonoj authored Aug 27, 2017
2 parents 2020c29 + b3315bc commit 3985de1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="0.0.5"></a>
## [0.0.5](https://github.com/kwonoj/rx-sandbox/compare/v0.0.4...v0.0.5) (2017-08-27)


### Features

* **advanceto:** implement advanceTo interface ([1d27849](https://github.com/kwonoj/rx-sandbox/commit/1d27849)), closes [#36](https://github.com/kwonoj/rx-sandbox/issues/36)



<a name="0.0.4"></a>
## [0.0.4](https://github.com/kwonoj/rx-sandbox/compare/v0.0.3...v0.0.4) (2017-08-21)

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,25 @@ expect(messages).to.deep.equal(expected);
expect(e1.subscriptions).to.deep.equal(subs);
```

Or if you need to control timeframe instead of flush out whole at once, you can use `advanceTo` as well.

```typescript
const e1 = hot(' --a--b--|');
const subs = s(` ^ !`);
const messages = getMessages(e1.mapTo('x'));

//at this moment, messages are empty!
expect(messages).to.be.empty;

advanceTo(3);
const expected = e('--x------'); // we're flushing to frame 3 only, so rest of marbles are not constructed

//now values are available
expect(messages).to.deep.equal(expected);
//subscriptions are also available too
expect(e1.subscriptions).to.deep.equal(subs);
```

#### Flushing scheduler automatically

By default sandbox instance requires to `flush()` explicitly to execute observables. For cases each test case doesn't require to schedule multiple observables but only need to test single, we can create sandbox instance to flush automatically. Since it flushes scheduler as soon as `getMessages` being called, subsequent `getMessages` call will raise errors.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rx-sandbox",
"version": "0.0.4",
"version": "0.0.5",
"description": "Marble diagram DSL based test suite for RxJS 5",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
Expand Down

0 comments on commit 3985de1

Please sign in to comment.