{"id":15504471,"url":"https://github.com/kwonoj/rxjs-testscheduler-compat","last_synced_at":"2025-04-23T00:13:12.612Z","repository":{"id":57125946,"uuid":"69597159","full_name":"kwonoj/rxjs-testscheduler-compat","owner":"kwonoj","description":"RxJS v4 TestScheduler interface for RxJS v5","archived":false,"fork":false,"pushed_at":"2018-09-19T22:42:26.000Z","size":139,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T00:12:55.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kwonoj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-29T18:43:38.000Z","updated_at":"2018-09-19T22:42:25.000Z","dependencies_parsed_at":"2022-08-31T12:10:25.829Z","dependency_job_id":null,"html_url":"https://github.com/kwonoj/rxjs-testscheduler-compat","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Frxjs-testscheduler-compat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Frxjs-testscheduler-compat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Frxjs-testscheduler-compat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Frxjs-testscheduler-compat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwonoj","download_url":"https://codeload.github.com/kwonoj/rxjs-testscheduler-compat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250343956,"owners_count":21415041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:18:14.386Z","updated_at":"2025-04-23T00:13:12.589Z","avatar_url":"https://github.com/kwonoj.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://circleci.com/gh/kwonoj/rxjs-testscheduler-compat/tree/master.svg?style=shield\u0026circle-token=:circle-token)](https://circleci.com/gh/kwonoj/rxjs-testscheduler-compat/tree/master)\r\n[![codecov](https://codecov.io/gh/kwonoj/rxjs-testscheduler-compat/branch/master/graph/badge.svg)](https://codecov.io/gh/kwonoj/rxjs-testscheduler-compat)\r\n[![npm (scoped)](https://img.shields.io/npm/v/@kwonoj/rxjs-testscheduler-compat.svg)](https://www.npmjs.com/package/@kwonoj/rxjs-testscheduler-compat)\r\n\r\n# RxJS-TestScheduler-Compat\r\n\r\n`rxjs-testscheduler-compat` provides RxJS v4's [test scheduler interface](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/testing/testscheduler.md) to v5 version of [RxJS](https://github.com/ReactiveX/rxjs) allows to migrate existing test cases with minimum effort as well as writing new test cases for certain cases.\r\n\r\n# Install\r\n\r\nThis has a peer dependencies of `rxjs@5.*.*`, which will have to be installed as well\r\n\r\n```sh\r\nnpm install @kwonoj/rxjs-testscheduler-compat\r\n```\r\n\r\n# Usage\r\n\r\nYou can import `TestScheduler` and other helpers to create test cases.\r\n\r\n```js\r\nimport * as Rx from 'rxjs';\r\nimport { TestScheduler, next, complete } from '@kwonoj/rxjs-testscheduler-compat';\r\n\r\nconst scheduler = new TestScheduler();\r\nconst observer = scheduler.createObserver();\r\n\r\nconst subject = scheduler.createHotObservable(\r\n      next(20, 'a'),\r\n      next(40, 'b'),\r\n      next(60, 'c'),\r\n      complete(80)\r\n    );\r\n\r\nsubject.subscribe(observer);\r\n\r\nscheduler.advanceTo(30);\r\n```\r\n\r\nAs this does not patches anything in RxJS v5's test scheduler, you can use both if it's needed\r\n\r\n```js\r\nimport * as Rx from 'rxjs';\r\nimport { TestScheduler as CompatScheduler } from '@kwonoj/rxjs-testscheduler-compat';\r\n\r\nconst v5Scheduler = new Rx.TestScheduler(...);\r\nconst v4Scheduler = new CompatScheduler();\r\n\r\n...\r\n```\r\n\r\n# Migrating from RxJS v4 test scheduler\r\n\r\nThere are few changes in api surfaces to conform with v5's scheduler interface as well as enhance conviniences.\r\n\r\n## ReactiveTest helper functions\r\n\r\n- `ReactiveTest.onNext(value)` -\u003e `next(value)`\r\n- `ReactiveTest.onError(value)` -\u003e `error(value)`\r\n- `ReactiveTest.onCompleted(value)` -\u003e `complete(value)`\r\n- `ReactiveTest.subscribe(value)` -\u003e `subscribe(value)`\r\n\r\nNotification factory method (`next`, `error`, `complete`) returns implementaiton of [`TestMessage`](https://github.com/ReactiveX/rxjs/blob/master/src/testing/TestMessage.ts)\r\nand `subscribe` returns [`SubscriptionLog`](https://github.com/ReactiveX/rxjs/blob/master/src/testing/SubscriptionLog.ts)\r\n\r\n## Scheduler instance functions\r\n\r\n- `TestScheduler::start()` -\u003e `TestScheduler::flush()`\r\n- does not support scheduler's instance methods for scheduling such as `scheduleFuture`, `schedulerRecursive`, `schedulePeriodic`... except `scheduleAbsolute`, `scheduleRelative`, `startScheduler`\r\n\r\n# Building / Testing\r\n\r\nFew npm scripts are supported for build / test code.\r\n\r\n- `build`: Transpiles code to ES5 commonjs to `dist`.\r\n- `build:clean`: Clean up existing build\r\n- `test`: Run unit test. Does not require `build` before execute test.\r\n- `test:cover`: Run code coverage against test cases\r\n- `lint`: Run lint over all codebases\r\n- `lint:staged`: Run lint only for staged changes. This'll be executed automatically with precommit hook.\r\n- `commit`: Commit wizard to write commit message","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwonoj%2Frxjs-testscheduler-compat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwonoj%2Frxjs-testscheduler-compat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwonoj%2Frxjs-testscheduler-compat/lists"}