Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Latest commit

 

History

History
40 lines (27 loc) · 880 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 880 Bytes

alsatian-enzyme

This package provides helpers for testing React components in Typescript with Enzyme and Alsatian.

Installation

npm i alsatian-enzyme

Usage

import { Test, TestFixture } from "alsatian";
import { ExpectElement } from "alsatian-enzyme";
import { shallow } from "enzyme";

import { MyComponent } from "./MyComponent";

@TestFixture("MyComponent")
export class MyComponentTests {

    @Test("should render component")
    public shouldRenderComponent() {

        const wrapper = shallow(<MyComponent />);

        ExpectElement(wrapper).toMatchElement(
            <div>
                My components body.
            </div>
        );
    }

}

License

Made with 💖 by NewOrbit in Oxfordshire, and licensed under the MIT Licence