New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mingus

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mingus

A testing library for React/Babel.

latest
Source
npmnpm
Version
0.12.0
Version published
Maintainers
1
Created
Source

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

Keywords

test

FAQs

Package last updated on 28 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts