This package provides helpers for testing React components in Typescript with Enzyme and Alsatian.
npm i alsatian-enzyme
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>
);
}
}
Made with 💖 by NewOrbit in Oxfordshire, and licensed under the MIT Licence