-
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
Entrega dos exercícios de TDD - Beatriz Gonçalves Locatelli #31
base: main
Are you sure you want to change the base?
Conversation
// const conta1 = new ContaBancaria("Beatriz", 500, 1000) | ||
|
||
// console.log(conta1) | ||
// console.log(conta1.deposito(2)) | ||
// console.log(conta1) | ||
// console.log(conta1.saque(600)) | ||
// console.log(conta1.consultarSaldo()) | ||
// console.log(conta1.aumentarLimite(2000)) | ||
// console.log(conta1.diminuirLimite(3000)) | ||
// console.log(conta1.desativarLimite(0)) |
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.
Esses comentários não são necessários no código
|
||
deposito(valor) { | ||
if (valor <= 0 || valor === null) { | ||
throw new error("O valor do depósito não pode ser 0 ou estar em branco") |
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.
Aqui na linha 17 o uso do throw new Error ta corretíssimo, só tem um errinho de tipagem, tu escreveru "error" ao inves de "Error"
expect(conta1.diminuirLimite(200)).toEqual(800) | ||
}) | ||
|
||
test("desativar limite", () => { |
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.
teste do limite ativado pra validar a criação da conta, exemplo:
test("ativar limite", () => {
expect(conta1.desativarLimite(1)).toEqual('limite ativado')
})
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.
Beleza! Obrigada pela explicação. Foi a parte que eu tive mais dúvida pra fazer.
this.limite -= valor | ||
return this.consultarLimite(); | ||
} else { | ||
throw new Error('O limite não está ativado') |
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.
a validação desse erro poderia ser adicionada no .test tambem
No description provided.