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

Helpers for testing React in TypeScript with Enzyme and Alsatian

License

Notifications You must be signed in to change notification settings

NewOrbit/alsatian-enzyme

Repository files navigation

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