0.12.0 • Published 8 years ago

mingus v0.12.0

Weekly downloads
5
License
MIT
Repository
github
Last release
8 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

8 years ago

0.11.0

8 years ago

0.10.2

8 years ago

0.10.1

8 years ago

0.10.0

8 years ago

0.9.0

8 years ago

0.8.4

8 years ago

0.8.3

8 years ago

0.8.2

8 years ago

0.8.1

8 years ago

0.8.0

8 years ago

0.7.9

8 years ago

0.7.8

8 years ago

0.7.7

8 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago