Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sukima/qunit-xstate-test
@xstate/test support for QUnit
https://github.com/sukima/qunit-xstate-test
Last synced: 24 days ago
JSON representation
@xstate/test support for QUnit
- Host: GitHub
- URL: https://github.com/sukima/qunit-xstate-test
- Owner: sukima
- License: mit
- Created: 2020-02-20T21:45:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T07:52:37.000Z (almost 2 years ago)
- Last Synced: 2024-10-21T21:02:16.395Z (30 days ago)
- Language: JavaScript
- Size: 1.24 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
qunit-xstate-test
==============================================================================QUnit integration with [@xstate/test](https://xstate.js.org/docs/packages/xstate-test/)
```ts
import { module } from 'qunit';
import { setupXStateTest, testShortestPaths } from 'qunit-xstate-test';
import { Machine } from 'xstate';
import { createModel } from '@xstate/test';const testModel = createModel(
Machine({
// ...
states: {
'state-name': {
meta: {
async test({ assert }) {
assert.equal(/* assert something about your state */);
}
}
}
}
})
);module('Testing my State Machine', function(hooks) {
setupXStateTest(hooks, testModel);testShortestPaths(testModel, (assert, path) => {
// set up for your tests
// ...
// pass `assert` to your meta.test context
return path.test({ assert });
});
});
```NOTE: `setupXStateTest` defines an `after` hook that checks your state machine's test coverage.
Examples:
- [Integration Test with an Ember App](https://github.com/sukima/qunit-xstate-test/blob/master/tests/integration/fixtures/ember-3.16/test-app/tests/unit/qunit-xstate-test.ts#L61-L73)
- [General `@xstate/test` Docs](https://xstate.js.org/docs/packages/xstate-test/)Installation
------------------------------------------------------------------------------```
yarn add --dev qunit-xstate-test
npm install --save-dev qunit-xstate-test
```## Ember Projects
Requirements: [ember-auto-import](https://github.com/ef4/ember-auto-import)
Contributing
------------------------------------------------------------------------------See the [Contributing](CONTRIBUTING.md) guide for details.
Prior Art
------------------------------------------------------------------------------
- [qunit-dom](https://github.com/simplabs/qunit-dom)
much of the config for this repo was taken from qunit-dom.License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).