Skip to content

Instantly share code, notes, and snippets.

@ryanluker
Created April 29, 2016 13:39
Show Gist options
  • Save ryanluker/e4c8647c3822767ed14e5c9d48e82994 to your computer and use it in GitHub Desktop.
Save ryanluker/e4c8647c3822767ed14e5c9d48e82994 to your computer and use it in GitHub Desktop.
testing price label and nested requires
jest.dontMock("../PriceLabel");
jest.dontMock("../../libs/helpers");
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as TestUtils from "react-addons-test-utils";
import {PriceLabel} from "../PriceLabel";
describe("PriceLabel", () => {
it("Renders and has nice looking price", () => {
let PriceLabelStateless = TestUtils.renderIntoDocument(
<div><PriceLabel price={120} /></div>
);
expect(TestUtils.isDOMComponent(PriceLabelStateless)).toBeTruthy();
expect(ReactDOM.findDOMNode(PriceLabelStateless).textContent).toBe("$1.20");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment