-
Notifications
You must be signed in to change notification settings - Fork 0
Semana12 aula4 week planner #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
pdarvas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brian, muito bom seu projeto. Conseguiu uma cobertura legal, apesar de um pouco abaixo dos 70%. Deixei alguns comentários, mas são detalhes. Atente-se principalmente à repetição de código. Quando for código parecido, extraia para uma função.
Parabéns!
| export const getTasks = () => async (dispatch) => { | ||
|
|
||
| const response = await axios.get(`${baseUrl}`) | ||
| dispatch(setTaskDayAction(response.data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identação
| day: 'Segunda' | ||
| }] | ||
|
|
||
| describe('Teste das actions', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não precisa explicitar que é um teste. E é uma boa deixar claro qual action ta sendo testada, como vc fez nos outros describes.
| }); | ||
|
|
||
| describe('teste do getTasks', () => { | ||
| it('teste para saber se o getTasks retorna um valor', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Também não precisa explicitar que é um teste. Procure colocar essa descricao do it no seguinte formato: "deve retornar um valor". E o describe seria só "getTasks". Então, o describe define o que está sendo testado, e o it define o que exatamente cada teste testa.
| let orderedMonday; | ||
|
|
||
| if(mondayFilter) { | ||
| orderedMonday = mondayFilter.sort((a,b) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todos os dias da semana têm a mesma lógica de ordenação, então você poderia ter extraído isso pra uma função:
sortDay(day) => {
return day.sort((a,b) => {
if(a.text > b.text) {
return 1;
} else if (a.text < b.text) {
return -1;
} else {
return 0
}
})
}
|
|
||
| const {tasks} = this.props; | ||
|
|
||
| const mondayFilter = tasks.filter((task) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todos os dias da semana têm a mesma lógica de filtro, então você poderia ter extraído isso pra uma função:
filterTasksByDay = (tasks, day) => {
return tasks.filter((task) => {
return task.day === day
})
| <DaysContainer> | ||
| <TasksContainerComponent | ||
| day="Monday" | ||
| text = {orderedMonday.map((task) => <Fragment><p>{task.text}</p></Fragment>)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esse fragment não é necessário.
PR - Week Planner
O que funciona
O que não funciona
Link:
Imagens (prints das telas)