Conversation
dailymp
left a comment
There was a problem hiding this comment.
As general comment, good work here, just minor changes left to conclude the test.
| </Button> | ||
| <div className="chip-container"> | ||
| {!!posts | ||
| ? posts.map((el /* : Object */) => ( |
There was a problem hiding this comment.
Please fix this commented code, you can declare an interface to type post, you can't type as Object
| import { GET_POST_FROM_API,DELETE_POST,ADD_POST } from './../constants'; | ||
| import { getPosts } from '../../myApi/index'; | ||
|
|
||
| export const getPostFromApi = ( posts: Object[]) => { |
There was a problem hiding this comment.
You can declare an interface to type post, you can't type as Object
| }; | ||
| }; | ||
|
|
||
| export const addPost = (post: Object) => { |
There was a problem hiding this comment.
Please fix this commented code, you can declare an interface to type post, you can't type as Object
| act, | ||
| RenderResult, | ||
| } from '@testing-library/react'; | ||
| //import * as myApi from '../myApi'; |
|
|
||
| import { useSelector, useDispatch } from 'react-redux'; | ||
| import { | ||
| /* fetchfruits, |
To finish here, please fix some minor comments I have requested you before and try to increase a little bit the coverage on those files needed #11 (comment) |
|
Object typing fix,comments removed and a new test to api has been added. |
| }; | ||
| const resolvePosts = (posts: any) => { | ||
| return posts; | ||
| console.log('resolvePosts -> posts', posts); |
| .then(resolvePosts) | ||
| .catch(handlePostError); | ||
| }; | ||
| const resolvePosts = (posts: any) => { |
| }; | ||
|
|
||
| export const deletePost = (id: Number) => { | ||
| export const deletePost = (id: Number) => { |
There was a problem hiding this comment.
its better to type as number instead of Number
| ]); | ||
| }); | ||
| it('should fecth some post from the api', () => { | ||
| expect(getPosts()).rejects.toThrowError('Error fetching'); |
There was a problem hiding this comment.
This test is not semantic, please fix it

Added a reducer test, action test and simple component test
I'm getting some errors while excuting tests due to some dependencies or loader configuration missing I think, even after executing npm i.