-
Notifications
You must be signed in to change notification settings - Fork 17
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
Rayane barbosa/testes unitarios #86
Rayane barbosa/testes unitarios #86
Conversation
…project readind practies and update files imports
src/components/header/index.tsx
Outdated
@@ -9,7 +9,7 @@ import { Fragment, useState } from 'react' | |||
import { Link, useLocation } from 'react-router-dom' | |||
import { Link as ScrollLink } from 'react-scroll' | |||
import { Logo } from '../logo' | |||
import { Button } from '../ui/button' | |||
import { Button } from '../ui/components/button/button' |
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.
Acredito que seja melhor ser amenas /ui/button (o arquivo do botão estar no index.tsx) e remover a pasta de components, já estamos dentro dela, não faz sentido ter components dentro de components. Já é entendível que itens dentro da ui são componentes.
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.
Eu atualizei dessa forma por se tratar de uma boa prática na escrita de testes unitários de acordo com a arquitetura component-based-architecture
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.
O projeto já está em arquitetura baseada em componentes, só não acredito que ter que importar form/form seja um modelo mental bom.
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.
Fora que também já estamos na pasta de components, não faz sentido ter outra. Se não daqui a pouco vamos ter ui/components/form/components...
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.
Blz. Vou realizar os ajustes
src/components/join-us/index.tsx
Outdated
@@ -1,12 +1,15 @@ | |||
import { ChevronRight } from 'lucide-react' | |||
import { Paw } from '../paw' | |||
import { Button } from '../ui/button' | |||
import { Button } from '../ui/components/button/button' |
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.
Acredito que seja melhor ser amenas /ui/button (o arquivo do botão estar no index.tsx) e remover a pasta de components, já estamos dentro dela, não faz sentido ter components dentro de components. Já é entendível que itens dentro da ui são componentes.
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.
Eu atualizei dessa forma por se tratar de uma boa prática na escrita de testes unitários de acordo com a arquitetura component-based-architecture
src/components/pet-card/index.tsx
Outdated
@@ -5,10 +5,10 @@ import { | |||
DialogPortal, | |||
DialogTitle, | |||
DialogTrigger, | |||
} from '@/components/ui/dialog' | |||
} from '@/components/ui/components/dialog/dialog' |
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.
Acredito que seja melhor ser amenas /ui/dialog (o arquivo do dialog estar no index.tsx) e remover a pasta de components, já estamos dentro dela, não faz sentido ter components dentro de components. Já é entendível que itens dentro da ui são componentes.
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.
Eu atualizei dessa forma por se tratar de uma boa prática na escrita de testes unitários de acordo com a arquitetura component-based-architecture
import '@testing-library/jest-dom' | ||
import { render, screen } from '@testing-library/react' | ||
import React from 'react' | ||
import { MaskedInput } from './input-masked' |
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.
Acredito que seja melhor e mais fácil deixar separado em pastas (input, input-masked e textarea) cada um com a sua pasta ao invés de todos ficarem dentro de input.
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.
Adicionei-os em input por se tratarem de entradas de texto (mesmo segmento) assim sendo mais fácil sua leitura e compreensão
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.
colocaria como index.tsx pra quando for usar não ficar um import duplicado. "/ui/components/form/form" e removeria o components já que já tem uma pasta mãe que se chama components.
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.
Eu atualizei dessa forma por se tratar de uma boa prática na escrita de testes unitários de acordo com a arquitetura component-based-architecture
Nos projetos é até preferivel você manter separação de componentes. No caso dos componentes UI os separei de forma que seja mais organizavel observar e criar os testes unitários e testes de componentes
src/pages/app/home/about-us.tsx
Outdated
@@ -1,5 +1,5 @@ | |||
import aboutUsImg from '@/assets/imgs/about-us.webp' | |||
import { ImageWithLoader } from '@/components/ui/image-with-loader' | |||
import { ImageWithLoader } from '@/components/ui/components/image-with-loader/image-with-loader' |
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.
same as before
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.
Eu atualizei dessa forma por se tratar de uma boa prática na escrita de testes unitários de acordo com a arquitetura component-based-architecture
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.
Comentáros revisados
Updates na estrutura de UI components e nos imports. Não consegui subir testes de TODOS os componentes. Então acho maneiro adotar como boas práticas não subir mais nada sem teste unitário |
Pull Request Description
Title: Addition of Unit Tests for Components and UI Components
Description:
This PR adds unit tests for components in the
src
folder and for UI components using Jest and Testing Library.Motivation:
How to Test:
Install dependencies:
Run the tests:
npm test
Official Documentation:
Resolves #85
Resolves #84
Thank you for reviewing and approving this PR.