react-ghost-test
v0.1.1
Published
test utils for react-ghost library
Downloads
4
Maintainers
Readme
react-ghost-test
Test utilities for react-ghost
Usage
import { crate, getTestUtils } from 'react-ghost-test'
const { waitForState, checkDispatch } = getTestUtils;
describe('init', () => {
test('create app actor', async () => {
await waitForState(
() => create(ghost(
StoreProvider,
{ value: store },
ghost(AppActor),
)),
[
(state) => expect(state).toHaveProperty('main'),
],
);
});
test('boot', async () => {
await checkDispatch(
mainActions.boot('main'),
[
(state) => state.toHaveProperty('main.booting', true),
(state) => state.toMatchObject({
main: {
booted: true,
booting: false,
},
history: {
location: { pathname: '/' },
},
}),
(state) => state.toMatchObject({
homePage: {
title: 'Home Page',
},
}),
],
);
});
});