-
Notifications
You must be signed in to change notification settings - Fork 35
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
Adicionado o Teste unitário e a Resolução de operações básicas. #23
base: main
Are you sure you want to change the base?
Conversation
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.
Arrasou muito e o seu código está muito bom! =)
|
||
return this.consultarSaldoAtual() | ||
} | ||
|
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.
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.
Os nomes dos testes são curtos e descritivos, o que é bom. Como sugestão, eu diria para deixa-los ainda mais descritivos, indicando exatamente o que está sendo testado.
- Sugestão: Alterar "Validar consulta do saldo", por "Deve retornar o saldo atual corretamente".
expect(() => { conta.validarLimiteExtraParaSaque(-2)}).toThrow() | ||
}) | ||
|
||
|
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.
|
||
// Saque | ||
test("Validar erro de saldo insuficiente", () => { | ||
expect(() => { conta.retirarValor(11000) }).toThrow() |
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.
expect(() => { conta.retirarValor(11000) }).toThrow() | |
expect(() => { conta.retirarValor(11000) }).toThrow("Saldo insuficiente"); |
Ao testar se uma exceção é lançada, é útil adicionar uma mensagem de erro descritiva para explicar o que está sendo testado. Isso facilita a depuração, caso um teste falhe.
|
||
// Limite | ||
test("Validar se o valor limite é um número positivo", () => { | ||
expect(() => { conta.validarLimiteExtraParaSaque(-2)}).toThrow() |
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.
expect(() => { conta.validarLimiteExtraParaSaque(-2)}).toThrow() | |
expect(() => { conta.validarLimiteExtraParaSaque(-2)}).toThrow("Valor Limite Não Pode Ser Negativo"); |
Adicionado o Teste unitário e a Resolução de operações básicas para contas bancárias.