Skip to content

Commit

Permalink
feat(API) : testing API
Browse files Browse the repository at this point in the history
  • Loading branch information
brucou committed Dec 3, 2018
1 parent 55302d5 commit c16b998
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,31 @@ For each test case/input sequence :
After each test case, the DOM anchor is emptied (`React.render(null, ...)`).
## getStateTransducerRxAdapter(RxApi)
```javascript
import { filter, flatMap, map, shareReplay, switchMap } from "rxjs/operators";
import { BehaviorSubject, merge, Observable } from "rxjs";

export const getStateTransducerRxAdapter = RxApi => {
const { BehaviorSubject, merge, Observable, filter, flatMap, map, shareReplay } = RxApi;

return {
// NOTE : this is start the machine, by sending the INIT_EVENT immediately prior to any other
subjectFactory: () => new BehaviorSubject([INIT_EVENT, void 0]),
// NOTE : must be bound, because, reasons
merge: merge,
create: fn => Observable.create(fn),
filter: filter,
map: map,
flatMap: flatMap,
shareReplay: shareReplay
};
};

```
# Tips and gotchas
- If the configured state machine library has an initial event, it can be passed using a behavior
subject (subject with an initial value). In that case, the `preprocessor` must be configured to
Expand Down

0 comments on commit c16b998

Please sign in to comment.