Skip to content

Commit 927d0ee

Browse files
feat: add rxjs exmaple (#39)
* feat: add rxjs example * chore: add link to rxjs example on README.md * feat: add README.md * fix: modify package.json that mocha version should be latest * fix: reformat with prettier * chore: modify README.md to trigger CLA after configuring email for this repo
1 parent 2fe8393 commit 927d0ee

File tree

7 files changed

+964
-0
lines changed

7 files changed

+964
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ A set of examples to help demontrate common configurations using Mocha. They sho
2121
- [Express REST API](packages/express-rest-api/)
2222
- [Node Sqlite 3 example](packages/node-sqlite3/)
2323
- [Playwright application](packages/playwright/)
24+
- [RxJs example](packages/rxjs/)
2425

2526
## Adding a new example
2627

packages/rxjs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

packages/rxjs/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# RxJs examples
2+
3+
Mocha test examples with marble diagram for RxJs(6.6.3).
4+
5+
This example focus on how to handle source properties and test process is described for observable streams handling properties.
6+
7+
First test proves an use case for marble diagram and helps understand basic operators of Observable.
8+
9+
Second test show a practical use case with Observable and custom operators by users.
10+
11+
## Commands
12+
13+
- `npm test` - Run mocha tests.

packages/rxjs/custom-operator.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { map, throttleTime } = require("rxjs/operators");
2+
3+
const getNames = (source) => source.pipe(map((value) => value.name));
4+
5+
const throttleTimeForThreeMs = (source) => source.pipe(throttleTime(3));
6+
7+
module.exports = {
8+
getNames,
9+
throttleTimeForThreeMs,
10+
};

0 commit comments

Comments
 (0)