Source code
Revision control
Copy as Markdown
Other Tools
import React from "react";
import { combineReducers, createStore } from "redux";
import { Provider } from "react-redux";
import { mount } from "enzyme";
import { INITIAL_STATE, reducers } from "common/Reducers.sys.mjs";
import { FocusTimer } from "content-src/components/Widgets/FocusTimer/FocusTimer";
const mockState = {};
function WrapWithProvider({ children, state = INITIAL_STATE }) {
let store = createStore(combineReducers(reducers), state);
return <Provider store={store}>{children}</Provider>;
}
describe("<FocusTimer>", () => {
let wrapper;
let sandbox;
let dispatch;
beforeEach(() => {
sandbox = sinon.createSandbox();
dispatch = sandbox.stub();
wrapper = mount(
<WrapWithProvider state={mockState}>
<FocusTimer dispatch={dispatch} />
</WrapWithProvider>
);
});
it("should render", () => {
assert.ok(wrapper.exists());
assert.ok(wrapper.find(".focus-timer-wrapper").exists());
});
});