-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,51 @@ | ||
# kefir-test-utils | ||
# <a id="kefir-test-utils"></a> [≡](#contents) [kefir-test-utils](#kefir-test-utils) · [![npm](https://img.shields.io/npm/dm/kefir-test-utils.svg)](https://www.npmjs.com/package/kefir-test-utils) | ||
|
||
Framework-agnostic testing tool for Kefir. | ||
Framework-agnostic testing tool for [Kefir](https://kefirjs.github.io/kefir/). | ||
|
||
[![npm version](https://badge.fury.io/js/kefir-test-utils.svg)](http://badge.fury.io/js/kefir-test-utils) | ||
[![Build Status](https://github.com/kefirjs/kefir-test-utils/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/kefirjs/kefir-test-utils/actions?query=workflow%3ACI) | ||
|
||
--- | ||
## <a id="contents"></a> [≡](#contents) [Contents](#contents) | ||
|
||
* [Plugin helpers](#plugin-helpers) | ||
* [`activate: (obs: Kefir.Observable) => void`](#activate) | ||
* [`deactivate: (obs: Kefir.Observable) => void`](#deactivate) | ||
* [`send: (obs: Kefir.Observable, values: Array<Event<T>>) => obs`](#send) | ||
* [`value: (value, options: ?{ current }) => Event<Value>`](#value) | ||
* [`error: (error, options: ?{ current }) => Event<Error>`](#error) | ||
* [`end: (options: ?{ current }) => Event<End>`](#end) | ||
* [`stream: () => Kefir.Stream`](#stream) | ||
* [`prop: () => Kefir.Property`](#prop) | ||
* [`pool: () => Kefir.Pool`](#pool) | ||
|
||
### <a id="plugin-helpers"></a> [≡](#contents) [Plugin helpers](#plugin-helpers) | ||
|
||
#### <a id="activate"></a> [≡](#contents) [`activate: (obs: Kefir.Observable) => void`](#activate) | ||
|
||
`activate` is a simple helper function to turn a stream on. | ||
|
||
#### <a id="deactivate"></a> [≡](#contents) [`deactivate: (obs: Kefir.Observable) => void`](#deactivate) | ||
|
||
`deactivate` is a simple helper function to turn a stream off. It can turn off streams that were activated with `activate`. Streams turned on through other means (direct call to `on{Value|Error|End|Any}`, use of `observe`, etc.) need to be deactivated through their complementary mechanisms. | ||
|
||
#### <a id="send"></a> [≡](#contents) [`send: (obs: Kefir.Observable, values: Array<Event<T>>) => obs`](#send) | ||
|
||
`send` is a helper function for emitting values into a given observable. Note that the second parameter is an array of values to emit from the observable. The `Event` is generated by the `value`, `error`, and `end` functions. For all three of these functions, the optional `options` object is not needed. | ||
|
||
#### <a id="value"></a> [≡](#contents) [`value: (value, options: ?{ current }) => Event<Value>`](#value) | ||
|
||
#### <a id="error"></a> [≡](#contents) [`error: (error, options: ?{ current }) => Event<Error>`](#error) | ||
|
||
#### <a id="end"></a> [≡](#contents) [`end: (options: ?{ current }) => Event<End>`](#end) | ||
|
||
`value` and `error` take a value or error and an optional `options` object and return an `Event` object that can be passed to `send`, `emit`, or `emitInTime`. `end` does not take this value, as the `end` event in Kefir does not send a value with it. | ||
|
||
When passing to `send`, the `options` object is ignored. `options` is used by `emit` and `emitInTime` (both described below) to determine whether the event should be treated as a `Kefir.Property`'s current event, error, or end. | ||
|
||
#### <a id="stream"></a> [≡](#contents) [`stream: () => Kefir.Stream`](#stream) | ||
|
||
#### <a id="prop"></a> [≡](#contents) [`prop: () => Kefir.Property`](#prop) | ||
|
||
#### <a id="pool"></a> [≡](#contents) [`pool: () => Kefir.Pool`](#pool) | ||
|
||
`stream`, `prop`, and `pool` are helper functions to create empty streams, properties, and pools. These can be used as mock sources to send values into. They have no other behavior. |