qunit-xstate-test
v0.1.0
Published
Use @xstate/test with QUnit
Downloads
144
Maintainers
Readme
qunit-xstate-test
QUnit integration with @xstate/test
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:
Installation
yarn add --dev qunit-xstate-test
npm install --save-dev qunit-xstate-test
Ember Projects
Requirements: ember-auto-import
Contributing
See the Contributing guide for details.
Prior Art
- qunit-dom much of the config for this repo was taken from qunit-dom.
License
This project is licensed under the MIT License.