diff --git a/.eslintrc b/.eslintrc
index 0fceae7..9831da5 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -21,6 +21,7 @@
"react"
],
"rules": {
- "react/jsx-filename-extension": 0
+ "react/jsx-filename-extension": 0,
+ "import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
}
}
\ No newline at end of file
diff --git a/client/src/components/UI/NavBar.jsx b/client/src/components/UI/NavBar.jsx
index 3d99a92..816fc93 100644
--- a/client/src/components/UI/NavBar.jsx
+++ b/client/src/components/UI/NavBar.jsx
@@ -25,9 +25,7 @@ const ButtonAppBar = ({ classes, isLoggedIn }) => (
{isLoggedIn
? (
- <>
-
- >
+
)
: }
diff --git a/client/src/components/UI/__tests__/navBar.test.js b/client/src/components/UI/__tests__/navBar.test.js
new file mode 100644
index 0000000..48e234e
--- /dev/null
+++ b/client/src/components/UI/__tests__/navBar.test.js
@@ -0,0 +1,26 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import NavBar from '../NavBar';
+
+describe('', () => {
+ it('should render', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().find('div').length).toBe(1);
+ });
+ it('should contain LogIn button by default', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().contains('login')).toBe(true);
+ });
+ it('should not contain Leader Board by default', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().contains('Leader Board')).toBe(false);
+ });
+ it('should not contain LogIn button if user has already logged in', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().contains('login')).toBe(false);
+ });
+ it('should contain Leader Board by default', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().contains('Leader Board')).toBe(true);
+ });
+});
diff --git a/client/src/components/UI/__tests__/scoreCard.test.js b/client/src/components/UI/__tests__/scoreCard.test.js
new file mode 100644
index 0000000..7109a04
--- /dev/null
+++ b/client/src/components/UI/__tests__/scoreCard.test.js
@@ -0,0 +1,20 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import Table from '@material-ui/core/Table';
+import TableRow from '@material-ui/core/TableRow';
+import ScoreCard from '../ScoreCard';
+
+describe('', () => {
+ it('should render just one Table at a time', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().find(Table).length).toBe(1);
+ });
+ it('should render three Rows if its not detailed scorecard', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().find(TableRow).length).toBe(3);
+ });
+ it('should render five Rows if its detailed scorecard', () => {
+ const wrapper = shallow();
+ expect(wrapper.dive().find(TableRow).length).toBe(5);
+ });
+});
diff --git a/client/src/setupTests.js b/client/src/setupTests.js
new file mode 100644
index 0000000..82edfc9
--- /dev/null
+++ b/client/src/setupTests.js
@@ -0,0 +1,4 @@
+import { configure } from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
+
+configure({ adapter: new Adapter() });