Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chlbri/test-machine
https://github.com/chlbri/test-machine
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/chlbri/test-machine
- Owner: chlbri
- License: mit
- Created: 2021-05-25T18:13:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-19T18:37:50.000Z (almost 3 years ago)
- Last Synced: 2024-05-31T15:30:47.328Z (7 months ago)
- Language: TypeScript
- Size: 927 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# THE LIBRARY WILL BE RENAMED @core/test-machine, this package will be archived in 6 months please switch
# For testing xstate machines
The package helps to run test for Observable Xstate machine
It's built with **tsdx** framework
### Two functions are used :
## `generateSyncMachineTest` :
As the name says, it's for synchronous machines which don't use promises
N.B/Changes : In the version 0.1.4, we have a correction, the number of values is the number of events + 1. It was an error of comprehension. So you test the initial state given by the variable 'initialState' or the initial context of the context. After, you test the others.
## `generateAsyncMachineTest` :
The main function with an **waiterBeforeEachEvent** variable. It is responsible to wait before each emission of an event.
Since we deal with Observable, we add an **timeout** variable to cancel test after a certain amount of time.
`Hope you enjoy these two functions !`