Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eccenca/ecc-test-helpers
Eccenca javascript test helpers
https://github.com/eccenca/ecc-test-helpers
Last synced: about 1 month ago
JSON representation
Eccenca javascript test helpers
- Host: GitHub
- URL: https://github.com/eccenca/ecc-test-helpers
- Owner: eccenca
- Created: 2016-05-02T12:08:21.000Z (over 8 years ago)
- Default Branch: develop
- Last Pushed: 2022-12-07T01:04:10.000Z (about 2 years ago)
- Last Synced: 2024-11-14T12:07:15.145Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 984 KB
- Stars: 0
- Watchers: 13
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Eccenca test helpers (ecc-test-helpers)
Offers a simple way to create an environment for testing.
Currently includes:
- [jsdom](https://github.com/tmpvar/jsdom) with [localStorage](https://github.com/lmaccherone/node-localstorage) for all your DOM needs
- [React](https://facebook.github.io/react/) and [TestUtils](https://facebook.github.io/react/docs/test-utils.html) (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](https://github.com/shouldjs/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:```js
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(
{}}/>,
this.container
);
// ...
});
});
});
```