diff --git a/backend/db.sqlite3 b/backend/db.sqlite3
index 6265512..40a02f5 100644
Binary files a/backend/db.sqlite3 and b/backend/db.sqlite3 differ
diff --git a/src/components/Calendar/Calendar.js b/src/components/Calendar/Calendar.js
index cbb6952..9df5257 100644
--- a/src/components/Calendar/Calendar.js
+++ b/src/components/Calendar/Calendar.js
@@ -64,7 +64,7 @@ const renderCalenderBody = (dates, todos, clickDone) => {
}
const renderCalendar = (dates, todos, clickDone) => (
-
+
{CALENDAR_HEADER}
{renderCalenderBody(dates, todos, clickDone)}
diff --git a/src/components/Calendar/Calendar.test.js b/src/components/Calendar/Calendar.test.js
new file mode 100644
index 0000000..a8a1cd7
--- /dev/null
+++ b/src/components/Calendar/Calendar.test.js
@@ -0,0 +1,59 @@
+import React from 'react';
+import { shallow, mount } from 'enzyme';
+import Calendar from './Calendar';
+
+
+const mockTodos = [
+ {
+ id: 1, title: 'TEST_TITLE_1', done: true,
+ year: 2019,
+ month: 9,
+ date: 1,
+ },
+ {
+ id: 2, title: 'TEST_TITLE_2', done: false,
+ year: 2019,
+ month: 9,
+ date: 2,
+ },
+ {
+ id: 3, title: 'TEST_TITLE_3', done: true,
+ year: 2019,
+ month: 10,
+ date: 1,
+ }
+];
+
+describe('', () => {
+ it('should render without errors', () => {
+ const component = shallow();
+ const wrapper = component.find('.CalendarTable');
+ expect(wrapper.length).toBe(1);
+ });
+
+ it('should render table without errors', () => {
+ const component = shallow();
+ let wrapper = component.find("Table");
+ expect(wrapper.length).toBe(1);
+ });
+
+ it('should render done for true', () => {
+ const component = shallow();
+ let wrapper = component.find('.done');
+ expect(wrapper.length).toBe(1);
+ });
+
+ it('should render notdone for false', () => {
+ const component = shallow();
+ const wrapper = component.find('.notdone');
+ expect(wrapper.length).toBe(1);
+ });
+
+ it('should handle clicks without errors', () => {
+ const mockClickDone = jest.fn();
+ const component = shallow();
+ const wrapper = component.find('.done').first();
+ wrapper.simulate('click');
+ expect(mockClickDone).toHaveBeenCalledTimes(1);
+ });
+});
\ No newline at end of file
diff --git a/src/containers/TodoCalendar/TodoCalendar.test.js b/src/containers/TodoCalendar/TodoCalendar.test.js
new file mode 100644
index 0000000..532749c
--- /dev/null
+++ b/src/containers/TodoCalendar/TodoCalendar.test.js
@@ -0,0 +1,84 @@
+import React from 'react';
+import { mount } from 'enzyme';
+import TodoCalendar from './TodoCalendar';
+import { getMockStore } from '../../test-utils/mocks';
+import { history } from '../../store/store';
+import { Provider } from 'react-redux';
+import { ConnectedRouter } from 'connected-react-router';
+import { Route, Switch } from 'react-router-dom';
+import * as actionCreators from '../../store/actions/todo';
+
+const stubInitialState = {
+ todos: [
+ {
+ id: 1, title: 'TEST_TITLE_1', done: true,
+ year: 2019,
+ month: 9,
+ date: 1,
+ },
+ {
+ id: 2, title: 'TEST_TITLE_2', done: false,
+ year: 2019,
+ month: 9,
+ date: 2,
+ },
+ {
+ id: 3, title: 'TEST_TITLE_3', done: true,
+ year: 2019,
+ month: 10,
+ date: 1,
+ }
+ ],
+ selectedTodo: null,
+};
+
+const mockStore = getMockStore(stubInitialState);
+
+describe('', () => {
+ let todoCalendar;
+
+ beforeEach(() => {
+ todoCalendar = (
+
+
+
+
+
+
+
+ );
+ })
+
+ it('should render without errors', () => {
+ const component = mount(todoCalendar);
+ const wrapper = component.find('.link');
+ expect(wrapper.length).toBe(1);
+ const wrapper2 = component.find('.header');
+ expect(wrapper2.length).toBe(1);
+ const wrapper3 = component.find('Calendar')
+ expect(wrapper3.length).toBe(1);
+ });
+
+ it('should click prev/next buttons', () => {
+ const component = mount(todoCalendar);
+ const wrapper = component.find('button');
+ wrapper.at(0).simulate('click');
+ const wrapper2 = component.find('.header');
+ let month = wrapper2.children().at(3).text();
+ expect(month).toBe('9');
+ wrapper.at(1).simulate('click');
+ const wrapper3 = component.find('.header');
+ month = wrapper3.children().at(3).text();
+ expect(month).toBe('10');
+ });
+
+ it('should clickDone work', () => {
+ const spyToggleTodo = jest.spyOn(actionCreators, 'toggleTodo')
+ .mockImplementation(id => { return dispatch => {}; });
+ const component = mount(todoCalendar);
+ const wrapper = component.find('.done').at(0);
+ wrapper.simulate('click');
+ expect(spyToggleTodo).toBeCalledTimes(1);
+ });
+
+});
\ No newline at end of file
diff --git a/src/containers/TodoList/NewTodo/NewTodo.js b/src/containers/TodoList/NewTodo/NewTodo.js
index 1ce93bc..7d2fd2a 100644
--- a/src/containers/TodoList/NewTodo/NewTodo.js
+++ b/src/containers/TodoList/NewTodo/NewTodo.js
@@ -23,7 +23,7 @@ class NewTodo extends Component {
...this.state,
dueDate: {
year: now.getFullYear(),
- month: now.getMonth() + 1,
+ month: now.getMonth(),
date: now.getDate(),
},
})
@@ -42,6 +42,7 @@ class NewTodo extends Component {
type="text"
value={this.state.title}
onChange={(event) => this.setState({ title: event.target.value })}
+ className="title"
>