Skip to content

Commit

Permalink
chore: Removing Unwanted files from latest commit
Browse files Browse the repository at this point in the history
- Renamed test files
- Installed jest to run client tests
  • Loading branch information
Benny Ogidan authored and Benny Ogidan committed Oct 30, 2017
1 parent 5c71a26 commit 715f78b
Show file tree
Hide file tree
Showing 47 changed files with 516 additions and 1,447 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
10 changes: 10 additions & 0 deletions client/__test__/reducers/bookReducers.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import bookreducer from '../../src/app/reducers/bookReducers';


describe('Book Reducer', () => {
it(' has a default state', () => {
expect(bookreducer(undefined, { type: 'undefinedAction' })).toEqual({
books: [], error: null, fetched: false, fetching: false
});
});
});
Binary file modified client/src/app/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions client/src/app/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ export default {
fetch: (offset, limit) => axios
.get(`api/v1/books?offset=${offset}&limit=${limit}`)
.then(res => res.data),
fetchRecentbooks: (offset, limit) => axios
.get(`api/v1/auth/books/recentbooks?offset=${offset}&limit=${limit}`)
.then(res => res.data),
fetchbyUserId: (offset, user, limit) => axios
.get(`api/v1/users/${user.id}/books?offset=${offset}&limit=${limit}&returned=false`)
.then(res => res.data)


}
};
7 changes: 3 additions & 4 deletions client/src/app/actions/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const signUpUserSuccess = user => ({ type: SIGNUP_USER_SUCCESS, user });
/**
*
* @param {*} data
*
*
* @returns {*} user.data
*/
export const signup = data => dispatch => api
.user
Expand All @@ -58,8 +57,8 @@ export const signup = data => dispatch => api
.catch(error => dispatch(signInUserFailure(error.response)));

/**
*
* @param {*} credentials
*
* @param {*} credentials
*/
export const login = credentials => dispatch => api
.user
Expand Down
33 changes: 31 additions & 2 deletions client/src/app/actions/fetchbooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ export const fetchBooksById = books => ({ type: FETCH_BOOKS_BY_USER_ID, books })
export const fetchBooksByIdRejected = error => ({ type: FETCH_BOOKS_REJECTED_BY_USER_ID, error });
export const fetchBooksByIdfufilled = books => ({ type: FETCH_BOOKS_FULFILLED_BY_USER_ID, books });


/**
* fetch books in thhe Library
* @return {any} dispatches an action
*
* @param {*} offset
* @param {*} limit
* @return {any} response
*
*/
export const fetchAllBooks = (offset, limit) => dispatch => api
.book
Expand All @@ -31,6 +35,31 @@ export const fetchAllBooks = (offset, limit) => dispatch => api
dispatch(fetchBooksRejected(error.response));
});

/**
*
* @param {*} offset
* @param {*} limit
* @return {any} response
*
*/
export const fetchBooksforDashboard = (offset, limit) => dispatch => api
.book
.fetchRecentbooks(offset, limit)
.then((response) => {
dispatch(fetchBooksfufilled(response));
return response;
})
.catch((error) => {
dispatch(fetchBooksRejected(error.response));
});

/**
*
* @param {*} offset
* @param {*} limit
* @param {*} userid
* @return {*} any
*/
export const fetchAllBooksbyId = (offset, limit, userid) => dispatch => api
.book
.fetchbyUserId(offset, limit, userid)
Expand Down
57 changes: 0 additions & 57 deletions client/src/app/components/Book.js

This file was deleted.

160 changes: 0 additions & 160 deletions client/src/app/components/Books.js

This file was deleted.

54 changes: 0 additions & 54 deletions client/src/app/components/BorrowedBooks.js

This file was deleted.

Loading

0 comments on commit 715f78b

Please sign in to comment.