Skip to content

Instantly share code, notes, and snippets.

@lynndylanhurley
Created November 29, 2015 19:28
Show Gist options
  • Save lynndylanhurley/55e361e0c65513e99420 to your computer and use it in GitHub Desktop.
Save lynndylanhurley/55e361e0c65513e99420 to your computer and use it in GitHub Desktop.
import jsdomify from "jsdomify";
var React,
TestUtils,
Sanity;
describe.only("sanity", () => {
before(() => {
jsdomify.create();
});
after(() => {
jsdomify.destroy();
});
beforeEach(() => {
jsdomify.clear();
React = require("react");
TestUtils = require("react-addons-test-utils");
});
// this test passes.
it("lets me render to the dom", () => {
class Test extends React.Component {
render() {
return <div>test</div>;
}
}
/* console.log(instance);
*
{ '$$typeof': Symbol(react.element),
type: [Function: Test],
key: null,
ref: null,
props: {},
_owner: null,
_store: {} }
*/
let instance = <Test />;
TestUtils.renderIntoDocument(instance);
});
// this test fails.
it("lets me render required components to the dom", () => {
Sanity = require("./Sanity");
let instance = <Sanity />;
/* console.log(instance);
*
{ '$$typeof': Symbol(react.element),
type: { default: [Function: Sanity] },
key: null,
ref: null,
props: {},
_owner: null,
_store: {} }
*/
TestUtils.renderIntoDocument(instance);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment