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

codewars+mathFunc+Classes #45

Open
wants to merge 4 commits into
base: Ivanov_Aleksej_Alekseevich
Choose a base branch
from

Conversation

Krovaldo
Copy link

@Krovaldo Krovaldo commented Oct 8, 2024

No description provided.

@FeLL1kS
Copy link

FeLL1kS commented Oct 10, 2024

Укажи правильный base. Если у тебя нет ветки, отпишись, создадим

this._color = color;
}

setAge(age: number){
Copy link

Choose a reason for hiding this comment

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

Геттеры и сеттеры пишутся по-другому, пожалуйста переделай корректно:

https://learn.javascript.ru/property-accessors?ysclid=m2342z978m930232161

it('Должно выкинуть ошибку при установке отрицательного возраста кролика', () => {
const testRabbit2 = new Rabbit(2, 'ewrt', 'grey');

expect(() => testRabbit2.setAge(-2)).toThrow('age cant be below zero');
Copy link

Choose a reason for hiding this comment

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

Можно еще проверять на тип ошибки, просто для информации, можешь это не делать:

expect(new Rabbit(2, 'ewrt', 'grey').rejects.toBeInstanceOf(Error)

@Krovaldo Krovaldo changed the base branch from master to Ivanov_Aleksej_Alekseevich October 10, 2024 17:42
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.

2 participants