From 1687a6ca1a0d55385d863cc5bdd0bd9d581b1318 Mon Sep 17 00:00:00 2001 From: Simon Chen Date: Wed, 14 Nov 2018 14:02:53 -0500 Subject: [PATCH] Clean up not needed example code --- src/data/actions/comment.js | 38 - src/data/actions/posts.js | 46 - src/data/actions/posts.test.js | 65 -- src/data/constants/actionTypes/comment.js | 11 - src/data/constants/actionTypes/posts.js | 9 - src/data/reducers/comment.js | 46 - src/data/reducers/grades.js | 1000 --------------------- src/data/reducers/posts.js | 31 - src/data/reducers/posts.test.js | 45 - 9 files changed, 1291 deletions(-) delete mode 100755 src/data/actions/comment.js delete mode 100755 src/data/actions/posts.js delete mode 100755 src/data/actions/posts.test.js delete mode 100755 src/data/constants/actionTypes/comment.js delete mode 100755 src/data/constants/actionTypes/posts.js delete mode 100755 src/data/reducers/comment.js delete mode 100755 src/data/reducers/posts.js delete mode 100755 src/data/reducers/posts.test.js diff --git a/src/data/actions/comment.js b/src/data/actions/comment.js deleted file mode 100755 index 2929d0b..0000000 --- a/src/data/actions/comment.js +++ /dev/null @@ -1,38 +0,0 @@ -import 'whatwg-fetch'; -import { - STARTED_FETCHING_COMMENT, - FINISHED_FETCHING_COMMENT, - ERROR_FETCHING_COMMENT, - GET_COMMENT, -} from '../constants/actionTypes/comment'; - -const startedFetchingComment = () => ({ type: STARTED_FETCHING_COMMENT }); -const finishedFetchingComment = () => ({ type: FINISHED_FETCHING_COMMENT }); -const errorFetchingComment = () => ({ type: ERROR_FETCHING_COMMENT }); -const getComment = comment => ({ type: GET_COMMENT, comment }); -const fetchComment = commentId => ( - (dispatch) => { - dispatch(startedFetchingComment()); - return fetch(`https://jsonplaceholder.typicode.com/comments/${commentId}`) - .then((response) => { - if (response.ok) { - return response.json(); - } - - throw new Error(); - }) - .then((data) => { - dispatch(getComment(data)); - dispatch(finishedFetchingComment()); - }) - .catch(() => dispatch(errorFetchingComment())); - } -); - -export { - startedFetchingComment, - finishedFetchingComment, - errorFetchingComment, - getComment, - fetchComment, -}; diff --git a/src/data/actions/posts.js b/src/data/actions/posts.js deleted file mode 100755 index 3854709..0000000 --- a/src/data/actions/posts.js +++ /dev/null @@ -1,46 +0,0 @@ -import 'whatwg-fetch'; - -import { - STARTED_FETCHING_POSTS, - FINISHED_FETCHING_POSTS, - GET_POSTS, -} from '../constants/actionTypes/posts'; - -const startedFetchingPosts = () => ( - { - type: STARTED_FETCHING_POSTS, - } -); - -const finishedFetchingPosts = () => ( - { - type: FINISHED_FETCHING_POSTS, - } -); - -const getPosts = posts => ( - { - type: GET_POSTS, - posts, - } -); - -const fetchPosts = () => ( - (dispatch) => { - dispatch(startedFetchingPosts()); - return fetch('https://jsonplaceholder.typicode.com/posts') - // TODO: handle response error - .then(response => response.json()) - .then((data) => { - dispatch(getPosts(data)); - dispatch(finishedFetchingPosts()); - }); - } -); - -export { - startedFetchingPosts, - finishedFetchingPosts, - getPosts, - fetchPosts, -}; diff --git a/src/data/actions/posts.test.js b/src/data/actions/posts.test.js deleted file mode 100755 index 84449e9..0000000 --- a/src/data/actions/posts.test.js +++ /dev/null @@ -1,65 +0,0 @@ -import configureMockStore from 'redux-mock-store'; -import thunk from 'redux-thunk'; -import fetchMock from 'fetch-mock'; - -import { - startedFetchingPosts, - finishedFetchingPosts, - getPosts, - fetchPosts, -} from './posts'; -import { - STARTED_FETCHING_POSTS, - GET_POSTS, - FINISHED_FETCHING_POSTS, -} from '../constants/actionTypes/posts'; - -const mockStore = configureMockStore([thunk]); - -describe('actions', () => { - afterEach(() => { - fetchMock.reset(); - fetchMock.restore(); - }); - - it('sends started fetching post action', () => { - const expected = { type: STARTED_FETCHING_POSTS }; - expect(startedFetchingPosts()).toEqual(expected); - }); - - it('sends finished fetching posts', () => { - const expected = { type: FINISHED_FETCHING_POSTS }; - expect(finishedFetchingPosts()).toEqual(expected); - }); - - it('sends posts', () => { - const data = 'data'; - const expected = { type: GET_POSTS, posts: data }; - expect(getPosts(data)).toEqual(expected); - }); - - it('fetches posts', () => { - const posts = [ - { - id: 1, - title: 'title', - body: 'body', - }, - ]; - fetchMock.getOnce('https://jsonplaceholder.typicode.com/posts', { - body: JSON.stringify({ posts }), - headers: { 'content-type': 'application/json' }, - }); - const store = mockStore({ posts: [] }); - - const expectedActions = [ - { type: STARTED_FETCHING_POSTS }, - { type: GET_POSTS, posts: { posts } }, - { type: FINISHED_FETCHING_POSTS }, - ]; - - return store.dispatch(fetchPosts()).then(() => { - expect(store.getActions()).toEqual(expectedActions); - }); - }); -}); diff --git a/src/data/constants/actionTypes/comment.js b/src/data/constants/actionTypes/comment.js deleted file mode 100755 index d71ce0f..0000000 --- a/src/data/constants/actionTypes/comment.js +++ /dev/null @@ -1,11 +0,0 @@ -const STARTED_FETCHING_COMMENT = 'STARTED_FETCHING_COMMENT'; -const FINISHED_FETCHING_COMMENT = 'FINISHED_FETCHING_COMMENT'; -const ERROR_FETCHING_COMMENT = 'ERROR_FETCHING_COMMENT'; -const GET_COMMENT = 'GET_COMMENT'; - -export { - STARTED_FETCHING_COMMENT, - FINISHED_FETCHING_COMMENT, - ERROR_FETCHING_COMMENT, - GET_COMMENT, -}; diff --git a/src/data/constants/actionTypes/posts.js b/src/data/constants/actionTypes/posts.js deleted file mode 100755 index d2b2b6e..0000000 --- a/src/data/constants/actionTypes/posts.js +++ /dev/null @@ -1,9 +0,0 @@ -const STARTED_FETCHING_POSTS = 'STARTED_FETCHING_POSTS'; -const GET_POSTS = 'GET_POSTS'; -const FINISHED_FETCHING_POSTS = 'FINISHED_FETCHING_POSTS'; - -export { - STARTED_FETCHING_POSTS, - GET_POSTS, - FINISHED_FETCHING_POSTS, -}; diff --git a/src/data/reducers/comment.js b/src/data/reducers/comment.js deleted file mode 100755 index e4e0f19..0000000 --- a/src/data/reducers/comment.js +++ /dev/null @@ -1,46 +0,0 @@ -import { - STARTED_FETCHING_COMMENT, - ERROR_FETCHING_COMMENT, - GET_COMMENT, -} from '../constants/actionTypes/comment'; - -const initialState = { - details: { - id: null, - postId: null, - name: '', - email: 'example@example.com', - body: '', - }, - startedFetching: false, - finishedFetching: false, - errorFetching: false, -}; - -const comment = (state = initialState, action) => { - switch (action.type) { - case GET_COMMENT: - return { - ...state, - details: { ...action.comment }, - finishedFetching: true, - errorFetching: false, - }; - case STARTED_FETCHING_COMMENT: - return { - ...state, - startedFetching: true, - finishedFetching: false, - }; - case ERROR_FETCHING_COMMENT: - return { - ...state, - finishedFetching: true, - errorFetching: true, - }; - default: - return state; - } -}; - -export default comment; diff --git a/src/data/reducers/grades.js b/src/data/reducers/grades.js index 056c214..9529b0c 100644 --- a/src/data/reducers/grades.js +++ b/src/data/reducers/grades.js @@ -40,1003 +40,3 @@ const grades = (state = initialState, action) => { }; export default grades; - - -// Gradebook.defaultProps = { -// "results": [ -// { -// "course_id": "course-v1:edX+DemoX+Demo_Course", -// "email": "honor@example.com", -// "user_id": 6, -// "username": "honor", -// "full_name": "", -// "passed": false, -// "percent": 0, -// "letter_grade": null, -// "progress_page_url": "/courses/course-v1:edX+DemoX+Demo_Course/progress/6/", -// "section_breakdown": [ -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Introduction", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@d8a6192ade314473a78242dfeedfbf5b", -// "subsection_name": "Demo Course Overview" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/3.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@19a30717eff543078a5d94ae9d6c18a5", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 3, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Lesson 1 - Getting Started" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/11.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 01", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 11, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Homework - Question Styles" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Lesson 2 - Let's Get Interactive!" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/5.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 02", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@graded_simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 5, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Labs and Demos" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/19.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@175e76c4951144a29d46211361266e0e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 19, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Essays" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@48ecb924d7fe4b66a230137626bfa93e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Lesson 3 - Be Social" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@dbe8fc027bcb4fe9afb744d2e8415855", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Homework - Find Your Study Buddy" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@6ab9c442501d472c8ed200e367b4edfa", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "More Ways to Connect" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Exam", -// "chapter_name": "About Exams and Certificates", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/6.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@workflow", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 6, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@1414ffd5143b4b508f739b563ab468b7", -// "subsection_name": "edX Exams" -// } -// ], -// "aggregates": { -// "Exam": { -// "score_possible": 6, -// "score_earned": 0 -// }, -// "Homework": { -// "score_possible": 16, -// "score_earned": 0 -// } -// } -// }, -// { -// "course_id": "course-v1:edX+DemoX+Demo_Course", -// "email": "audit@example.com", -// "user_id": 7, -// "username": "audit", -// "full_name": "", -// "passed": false, -// "percent": 0.17, -// "letter_grade": null, -// "progress_page_url": "/courses/course-v1:edX+DemoX+Demo_Course/progress/7/", -// "section_breakdown": [ -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Introduction", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@d8a6192ade314473a78242dfeedfbf5b", -// "subsection_name": "Demo Course Overview" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/3.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@19a30717eff543078a5d94ae9d6c18a5", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 3, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Lesson 1 - Getting Started" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.45", -// "is_graded": true, -// "grade_description": "(5.00/11.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 01", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions", -// "percent": 0.45, -// "score_earned": 5, -// "score_possible": 11, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Homework - Question Styles" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Lesson 2 - Let's Get Interactive!" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/5.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 02", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@graded_simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 5, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Labs and Demos" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/19.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@175e76c4951144a29d46211361266e0e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 19, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Essays" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@48ecb924d7fe4b66a230137626bfa93e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Lesson 3 - Be Social" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@dbe8fc027bcb4fe9afb744d2e8415855", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Homework - Find Your Study Buddy" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@6ab9c442501d472c8ed200e367b4edfa", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "More Ways to Connect" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Exam", -// "chapter_name": "About Exams and Certificates", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/6.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@workflow", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 6, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@1414ffd5143b4b508f739b563ab468b7", -// "subsection_name": "edX Exams" -// } -// ], -// "aggregates": { -// "Exam": { -// "score_possible": 6, -// "score_earned": 0 -// }, -// "Homework": { -// "score_possible": 16, -// "score_earned": 5 -// } -// } -// }, -// { -// "course_id": "course-v1:edX+DemoX+Demo_Course", -// "email": "verified@example.com", -// "user_id": 8, -// "username": "verified", -// "full_name": "", -// "passed": false, -// "percent": 0, -// "letter_grade": null, -// "progress_page_url": "/courses/course-v1:edX+DemoX+Demo_Course/progress/8/", -// "section_breakdown": [ -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Introduction", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@d8a6192ade314473a78242dfeedfbf5b", -// "subsection_name": "Demo Course Overview" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/3.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@19a30717eff543078a5d94ae9d6c18a5", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 3, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Lesson 1 - Getting Started" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/11.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 01", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 11, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Homework - Question Styles" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Lesson 2 - Let's Get Interactive!" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/5.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 02", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@graded_simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 5, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Labs and Demos" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/19.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@175e76c4951144a29d46211361266e0e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 19, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Essays" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@48ecb924d7fe4b66a230137626bfa93e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Lesson 3 - Be Social" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@dbe8fc027bcb4fe9afb744d2e8415855", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Homework - Find Your Study Buddy" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@6ab9c442501d472c8ed200e367b4edfa", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "More Ways to Connect" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Exam", -// "chapter_name": "About Exams and Certificates", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/6.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@workflow", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 6, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@1414ffd5143b4b508f739b563ab468b7", -// "subsection_name": "edX Exams" -// } -// ], -// "aggregates": { -// "Exam": { -// "score_possible": 6, -// "score_earned": 0 -// }, -// "Homework": { -// "score_possible": 16, -// "score_earned": 0 -// } -// } -// }, -// { -// "course_id": "course-v1:edX+DemoX+Demo_Course", -// "email": "staff@example.com", -// "user_id": 9, -// "username": "staff", -// "full_name": "", -// "passed": false, -// "percent": 0, -// "letter_grade": null, -// "progress_page_url": "/courses/course-v1:edX+DemoX+Demo_Course/progress/9/", -// "section_breakdown": [ -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Introduction", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@d8a6192ade314473a78242dfeedfbf5b", -// "subsection_name": "Demo Course Overview" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/3.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@19a30717eff543078a5d94ae9d6c18a5", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 3, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Lesson 1 - Getting Started" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 1: Getting Started", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/11.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 01", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 11, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@interactive_demonstrations", -// "subsection_name": "Homework - Question Styles" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Lesson 2 - Let's Get Interactive!" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Homework", -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/5.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": "Ex 02", -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@graded_simulations", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 5, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Labs and Demos" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 2: Get Interactive", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/19.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@175e76c4951144a29d46211361266e0e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 19, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@graded_interactions", -// "subsection_name": "Homework - Essays" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@48ecb924d7fe4b66a230137626bfa93e", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Lesson 3 - Be Social" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@dbe8fc027bcb4fe9afb744d2e8415855", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "Homework - Find Your Study Buddy" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "Example Week 3: Be Social", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@6ab9c442501d472c8ed200e367b4edfa", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@social_integration", -// "subsection_name": "More Ways to Connect" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": "Exam", -// "chapter_name": "About Exams and Certificates", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": true, -// "grade_description": "(0.00/6.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@workflow", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 6, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@1414ffd5143b4b508f739b563ab468b7", -// "subsection_name": "edX Exams" -// }, -// { -// "are_grades_published": true, -// "auto_grade": false, -// "category": null, -// "chapter_name": "holding section", -// "comment": "", -// "detail": "", -// "displayed_value": "0.00", -// "is_graded": false, -// "grade_description": "(0.00/0.00)", -// "is_ag": false, -// "is_average": false, -// "is_manually_graded": false, -// "label": null, -// "letter_grade": null, -// "module_id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@07bc32474380492cb34f76e5f9d9a135", -// "percent": 0, -// "score_earned": 0, -// "score_possible": 0, -// "section_block_id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@9fca584977d04885bc911ea76a9ef29e", -// "subsection_name": "New Subsection" -// } -// ], -// "aggregates": { -// "Exam": { -// "score_possible": 6, -// "score_earned": 0 -// }, -// "Homework": { -// "score_possible": 16, -// "score_earned": 0 -// } -// } -// } -// ] -// }; diff --git a/src/data/reducers/posts.js b/src/data/reducers/posts.js deleted file mode 100755 index 43e02f3..0000000 --- a/src/data/reducers/posts.js +++ /dev/null @@ -1,31 +0,0 @@ -import { - GET_POSTS, - STARTED_FETCHING_POSTS, - FINISHED_FETCHING_POSTS, -} from '../constants/actionTypes/posts'; - -const posts = (state = { posts: [], startedFetching: false, finishedFetching: false }, action) => { - switch (action.type) { - case GET_POSTS: - return { - ...state, - posts: action.posts, - }; - case STARTED_FETCHING_POSTS: - return { - ...state, - startedFetching: true, - finishedFetching: false, - }; - case FINISHED_FETCHING_POSTS: - return { - ...state, - startedFetching: false, - finishedFetching: true, - }; - default: - return state; - } -}; - -export default posts; diff --git a/src/data/reducers/posts.test.js b/src/data/reducers/posts.test.js deleted file mode 100755 index cdcb70e..0000000 --- a/src/data/reducers/posts.test.js +++ /dev/null @@ -1,45 +0,0 @@ -import posts from './posts'; -import { - GET_POSTS, - STARTED_FETCHING_POSTS, - FINISHED_FETCHING_POSTS, -} from '../constants/actionTypes/posts'; - -const initialState = { - posts: [], - startedFetching: false, - finishedFetching: false, -}; - -describe('posts reducer', () => { - it('has initial state', () => { - expect(posts(undefined, {})).toEqual(initialState); - }); - - it('adds posts', () => { - const fetchedPosts = [1, 2, 3]; - const expected = { - ...initialState, - posts: fetchedPosts, - }; - expect(posts(undefined, { type: GET_POSTS, posts: fetchedPosts })).toEqual(expected); - }); - - it('updates started fetching posts state', () => { - const expected = { - ...initialState, - startedFetching: true, - finishedFetching: false, - }; - expect(posts(undefined, { type: STARTED_FETCHING_POSTS })).toEqual(expected); - }); - - it('updates finished fetching posts state', () => { - const expected = { - ...initialState, - startedFetching: false, - finishedFetching: true, - }; - expect(posts(undefined, { type: FINISHED_FETCHING_POSTS })).toEqual(expected); - }); -});