0.1.1 • Published 3 years ago

react-ghost-test v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

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