Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Luceliabatista
Copy link

Adicionado o Teste unitário e a Resolução de operações básicas para contas bancárias.

Copy link

@helloLari helloLari left a 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()
}

Choose a reason for hiding this comment

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

Suggested change

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()
})


Choose a reason for hiding this comment

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

Suggested change


// Saque
test("Validar erro de saldo insuficiente", () => {
expect(() => { conta.retirarValor(11000) }).toThrow()

Choose a reason for hiding this comment

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

Suggested change
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()

Choose a reason for hiding this comment

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

Suggested change
expect(() => { conta.validarLimiteExtraParaSaque(-2)}).toThrow()
expect(() => { conta.validarLimiteExtraParaSaque(-2)}).toThrow("Valor Limite Não Pode Ser Negativo");

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.

None yet

2 participants