This question is similar to this previous one I opened. But now I'm using a different framework, Jest.
My code goes like this:
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as injectTapEventPlugin from "react-tap-event-plugin";
import Application from "./components/Application";
import "./assets/styles/theme.css";
injectTapEventPlugin();
ReactDOM.render(<Application />, document.getElementById("root"));
There's 3 things that I'd like to test here:
injectTapEventPlugin()
was called.ReactDOM.render
was called with the expected arguments,<Application />
, anddocument.getElementById("root")
, respectively.- That
./assets/styles/theme.css
was imported. I know this one is weird but this import is here so that webpack picks it up and includes it in the final bundle. Maybe this import shouldn't exist and I should make sure thattheme.css
file is lodaded in some other way.
At least 1 and 2 needs to be tested I think... Jest uses Jasmine2 and I'm also using Enzyme (but that probably doesn't help here).
Any help is appreciated :)