react-ghost-test

0.1.1 • Public • Published

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',
          },
        }),
      ],
    );
  });
});

Package Sidebar

Install

npm i react-ghost-test

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

7.48 kB

Total Files

6

Last publish

Collaborators

  • simprl