0.12.0 • Published 9 years ago

mingus v0.12.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

mingus

mingus is a testing library for React components using babel, mocha, istanbul, sinon, and chai.

Install

To install the latest release:

npm install mingus

To build the latest code directly from source:

npm install git://github.com/jmcriffey/mingus.git

Usage

src/CoolComponent.js:

import React from 'react';
import someLib from 'someLib';


class CoolComponent extends React.Component {
    render() {
        return (
            <ul className="cool-list">
                <li className="cool-list-item">1</li>
                <li className="cool-list-item">2</li>
            </ul>
        );
    }

    getNum() {
        return someLib.getNum();
    }
}

export default CoolComponent;

tests/CoolComponent-test.js:

import Mingus from 'mingus';
import someLib from 'someLib';

import CoolComponent from './CoolComponent';


Mingus.createTestCase({
    beforeEach() {
        this.rendered = this.renderComponent(CoolComponent);
        this.component = this.createComponent(CoolComponent);
    },

    testType() {
        this.assertIsType(this.rendered, 'ul')
    },

    testClass() {
        this.assertHasClass(this.rendered, 'cool-list');
    },

    testChildrenClasses() {
        this.assertEveryChildHasClass(this.rendered, 'cool-list-item');
        this.assertSomeChildHasClass(this.rendered, 'cool-list-item');
    },

    testChildrenTypes() {
        this.assertEveryChildIsType(this.rendered, 'li');
        this.assertSomeChildIsType(this.rendered, 'li');
    },

    testNthChildClass() {
        this.assertNthChildHasClass(this.rendered, 0, 'cool-list-item');
    },

    testNthChildType() {
        this.assertNthChildIsType(this.rendered, 0, 'li');
    },

    testGetNum() {
        this.stub(someLib, 'getNum', () => 777);
        this.assertEqual(component.getNum(), 777);
    }
});

On the command line:

mingus cover && mingus check-coverage

Without coverage:

mingus unit

License

MIT License

0.12.0

9 years ago

0.11.0

9 years ago

0.10.2

9 years ago

0.10.1

9 years ago

0.10.0

10 years ago

0.9.0

10 years ago

0.8.4

10 years ago

0.8.3

10 years ago

0.8.2

10 years ago

0.8.1

10 years ago

0.8.0

10 years ago

0.7.9

10 years ago

0.7.8

10 years ago

0.7.7

10 years ago

0.7.6

10 years ago

0.7.5

10 years ago

0.7.4

10 years ago

0.7.3

10 years ago

0.7.2

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago