Skip to content

Feature/issue#1 redux test#11

Open
Carchuli wants to merge 16 commits intodevelopfrom
feature/issue#1-redux-test
Open

Feature/issue#1 redux test#11
Carchuli wants to merge 16 commits intodevelopfrom
feature/issue#1-redux-test

Conversation

@Carchuli
Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Owner

@dailymp dailymp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As general comment, good work here, just minor changes left to conclude the test.

</Button>
<div className="chip-container">
{!!posts
? posts.map((el /* : Object */) => (
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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[]) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can declare an interface to type post, you can't type as Object

};
};

export const addPost = (post: Object) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete all comented code

Copy link
Copy Markdown
Owner

@dailymp dailymp Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to increase the coverage here
image


import { useSelector, useDispatch } from 'react-redux';
import {
/* fetchfruits,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete commented code

@dailymp
Copy link
Copy Markdown
Owner

dailymp commented Apr 14, 2020

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.

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)

@Carchuli
Copy link
Copy Markdown
Collaborator Author

Object typing fix,comments removed and a new test to api has been added.
I'll try to add another test to inputComponent

Copy link
Copy Markdown
Owner

@dailymp dailymp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please just fix this comments to conclude the test.

Also you have conflicts again, please fix it!

};
const resolvePosts = (posts: any) => {
return posts;
console.log('resolvePosts -> posts', posts);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this comment

.then(resolvePosts)
.catch(handlePostError);
};
const resolvePosts = (posts: any) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This posts is not typed

};

export const deletePost = (id: Number) => {
export const deletePost = (id: Number) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its better to type as number instead of Number

]);
});
it('should fecth some post from the api', () => {
expect(getPosts()).rejects.toThrowError('Error fetching');
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not semantic, please fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants