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

Entrega dos exercícios de TDD - Beatriz Gonçalves Locatelli #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bialocatelli
Copy link

No description provided.

Comment on lines +68 to +77
// 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))

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")

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", () => {

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

Copy link
Author

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')

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

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