-
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
ADD: resolução de exercicios TDD - Geice #39
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.
elogio:
Parabéns, Geice!
Gostei de como desenvolveu seu exercício, e deixei algumas sugestões de implementações. Se precisar de ajuda, conte comigo! ♥
exercicios/para-casa/entregas/Geice-SousaPinho/resolucaoGeice.js
Outdated
Show resolved
Hide resolved
|
||
sacar(valor){ | ||
if (valor <= this.saldo || valor <= this.limite){ | ||
return valor |
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.
sugestão: retornar uma mensagem com os valores de saldo e limite disponíveis, após o saque
exemplo: Saque no valor de R$${valor} realizado! Saldo disponível: R$${this.saldo}. Limite disponível: R$${this.limite}
if (valor <= this.saldo || valor <= this.limite){ | ||
return valor | ||
} | ||
else{ |
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.
sugestão: implementar cenário caso o valor ultrapasse saldo e limite disponíveis, para a mensagem de erro:
Saldo e limite insuficientes para saque.
ou, cenário em que o saque acontece, e esses valores ficarão negativados
.
} | ||
} | ||
|
||
depositar(valor){ |
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.
sugestão: retornar uma mensagem com o saldo disponível, após depósito.
exemplo:
let saldoAtualizado = valor + this.saldo
return Você depositou R$${valor}. Saldo disponível: R$${saldoAtualizado}
depositar(valor){ | ||
if (valor) return valor | ||
else{ | ||
throw new Error('houve um erro inesperado, tenve novamente em instantes') |
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.
dúvida: a mensagem de erro está clara, mas, usando valor
como parâmentro, não entendi em que momento esse cenário isso poderia acontecer.
sugestão: implementar lógica usando as informações de agencia
ou numero de conta
incorretos, já que isso impossibilitaria o sucesso da transação, e são atributos que você criou em seu objeto ContaBancaria :)
typo: corrigir "tenve" para "tente"
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 cenário para o erro é quando não passa um argumento
exercicios/para-casa/entregas/Geice-SousaPinho/resolucaoGeice.js
Outdated
Show resolved
Hide resolved
// const cliente = 'Geice Sousa'; const agencia = 1230; const conta = 789456.32; const limite = 1500.00; const saldo = 1000.00 | ||
const valor = 200.00 | ||
const valorDeAjuste = 500.00 |
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.
sugestão: já que os valores de testes são fixos, você pode remover essas constantes, e inserir os valores diretamente nas respectivas funções.
exemplo:
em lugar de:
expect(contaCliente.depositar(valor)).toBeTruthy()
implementar:
expect(contaCliente.depositar(200.00)).toBeTruthy()
faltando 45 para acabar o tempo rs