Skip to content

Instantly share code, notes, and snippets.

@ryanluker
Created April 29, 2016 06:03
Show Gist options
  • Save ryanluker/a8624cdc61de4e37b7afadc609a77835 to your computer and use it in GitHub Desktop.
Save ryanluker/a8624cdc61de4e37b7afadc609a77835 to your computer and use it in GitHub Desktop.
Simple jest test file
jest.dontMock("../AddFishButton");
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as TestUtils from "react-addons-test-utils";
import {AddFishButton} from "../AddFishButton";
describe("AddFishButton", () => {
it("Renders", () => {
let addFishProps = {
text: "What goes here",
isAvailable: false,
addToOrder: function(){return;}
};
let AddFishStateless = TestUtils.renderIntoDocument(
<div><AddFishButton {...addFishProps}/></div>
);
expect(ReactDOM.findDOMNode(AddFishStateless).textContent).toBe("What goes here");
expect(ReactDOM.findDOMNode(AddFishStateless).innerHTML).toContain("disabled");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment