diff --git a/react-context-api/src/App.js b/react-context-api/src/App.js
index c3f4e9c24..f02690c46 100644
--- a/react-context-api/src/App.js
+++ b/react-context-api/src/App.js
@@ -44,7 +44,7 @@ class App extends React.Component {
render() {
return (
-
+
diff --git a/react-context-api/src/App.test.js b/react-context-api/src/App.test.js
new file mode 100644
index 000000000..5c70fc828
--- /dev/null
+++ b/react-context-api/src/App.test.js
@@ -0,0 +1,27 @@
+import React from "react";
+import { shallow } from "enzyme";
+import { findByDataAttr, testStore } from "./utils/utils";
+import App from "./App";
+
+const setUp = (initialState = {}) => {
+ const store = testStore(initialState);
+ const wrapper = shallow()
+ .childAt(0)
+ .dive();
+ // console.log(wrapper.debug());
+ return wrapper;
+};
+
+describe("Render App Component Without Error", () => {
+ let wrapper;
+ beforeEach(() => {
+ const initialState = {
+ currentUser: {}
+ };
+ wrapper = setUp(initialState);
+ });
+ it("Should render without errors", () => {
+ const component = findByDataAttr(wrapper, "app");
+ expect(component.length).toBe(1);
+ });
+});
diff --git a/react-context-api/src/redux/root-reducer.js b/react-context-api/src/redux/root-reducer.js
index 47ad9a90a..fe4fe3fa9 100644
--- a/react-context-api/src/redux/root-reducer.js
+++ b/react-context-api/src/redux/root-reducer.js
@@ -1,19 +1,19 @@
-import { combineReducers } from 'redux';
-import { persistReducer } from 'redux-persist';
-import storage from 'redux-persist/lib/storage';
+import { combineReducers } from "redux";
+import { persistReducer } from "redux-persist";
+import storage from "redux-persist/lib/storage";
-import userReducer from './user/user.reducer';
-import cartReducer from './cart/cart.reducer';
-import directoryReducer from './directory/directory.reducer';
-import shopReducer from './shop/shop.reducer';
+import userReducer from "./user/user.reducer";
+import cartReducer from "./cart/cart.reducer";
+import directoryReducer from "./directory/directory.reducer";
+import shopReducer from "./shop/shop.reducer";
const persistConfig = {
- key: 'root',
+ key: "root",
storage,
- whitelist: ['cart']
+ whitelist: ["cart"]
};
-const rootReducer = combineReducers({
+export const rootReducer = combineReducers({
user: userReducer,
cart: cartReducer,
directory: directoryReducer,
diff --git a/react-context-api/src/redux/store.js b/react-context-api/src/redux/store.js
index 73ac14b9f..90c66e4d6 100644
--- a/react-context-api/src/redux/store.js
+++ b/react-context-api/src/redux/store.js
@@ -1,12 +1,12 @@
-import { createStore, applyMiddleware } from 'redux';
-import { persistStore } from 'redux-persist';
-import logger from 'redux-logger';
+import { createStore, applyMiddleware } from "redux";
+import { persistStore } from "redux-persist";
+import logger from "redux-logger";
-import rootReducer from './root-reducer';
+import rootReducer from "./root-reducer";
-const middlewares = [];
+export const middlewares = [];
-if (process.env.NODE_ENV === 'development') {
+if (process.env.NODE_ENV === "development") {
middlewares.push(logger);
}