ecc-test-helpers
A common cli test environment and helpers for testing components, stores and widgets.
Last updated 3 years ago by leipert .
GPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ecc-test-helpers 
SYNC missed versions from official npm registry.

Eccenca test helpers (ecc-test-helpers)

Offers a simple way to create an environment for testing.

Currently includes:

  • jsdom with localStorage for all your DOM needs
  • React and TestUtils (exposed via mocha this context)
  • Container for rendering your component that is create before each test and disposed afterwards (exposed via mocha context)
  • Should.js for your assertions (exposed as default module export)

Usage

  • Install module into your project (and save as dev deps) using npm install --save-dev ecc-test-helpers
  • Import the module in the beginning of your test suite using import should from 'ecc-test-helpers'
  • Access React, TestUtils and test container using this context, like so:

import should from 'ecc-test-helpers';
import Component from '../src/component';

describe('Component suite', function() {
    describe('Component', function() {
        it('Should render ...', function() {
            const React = this.React;
            const TestUtils = this.TestUtils;

            // render
            const comp = React.render(
                <TestComp handleModelSelect={() => {}}/>,
                this.container
            );
            // ...
        });
    });
});

Current Tags

  • 15.2.0                                ...           latest (3 years ago)

6 Versions

  • 15.2.0                                ...           3 years ago
  • 15.1.0                                ...           4 years ago
  • 15.0.1                                ...           4 years ago
  • 15.0.0                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |