@airglow/plugin-test
A plugin that stores dispatches for testing
Last updated 2 months ago by dgrossen .
Apache · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @airglow/plugin-test 
SYNC missed versions from official npm registry.

Airglow Test Plugin

An Airglow plugin that adds a reducer that tracks all calls that are dispatched throught Airglow.

Usage

Simply enable it:

import testPlugin from '@airglow/plugin-test';

const App = () => (
  <Airglow plugins={{
    testPlugin()
  }}>
    <AppContainer />
  </Airglow>
);

You can access data using lastDispatch and dispatchList:

import React from 'react';
import ReactStore from '@airglow/store-react';
import plugin, { lastDispatch, dispatchList } from '@airglow/plugin-test';
import { renderAirglow } from '../../../../test/util/test.utils';

describe('MyTest', () => {
  beforeEach(() => {
    tree = renderAirglow(
      <div />,
      {
        plugins: [plugin()],
        store: ReactStore
      }
    );
    tree.dispatch({ type: 'testEvent' });
    tree.dispatch({ type: 'another' });
  });
  it('should keep track of all the dispatches', function () {
    expect(dispatchList(tree.getState())).toMatchSnapshot();
  });
  it('should correctly get the last event', function () {
    expect(lastDispatch(tree.getState())).toMatchSnapshot();
  });
});

That's it!

Current Tags

  • 0.8.0                                ...           latest (2 months ago)

13 Versions

  • 0.8.0                                ...           2 months ago
  • 0.7.0                                ...           7 months ago
  • 0.6.2                                ...           7 months ago
  • 0.6.1                                ...           7 months ago
  • 0.6.0                                ...           7 months ago
  • 0.5.2                                ...           8 months ago
  • 0.5.0                                ...           a year ago
  • 0.4.0                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 39
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |