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

Solution #590

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/getHumanAge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,21 @@ describe('getHumanAge', () => {
expect(getHumanAge)
.toBeInstanceOf(Function);
});

test('animals` human age should be 0 if their own age < 15', () => {
expect(getHumanAge(0, 14)).toEqual([0, 0]);
});

Choose a reason for hiding this comment

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

The test description and expectation seem correct for ages less than 15, assuming the function is supposed to return 0 for both animals. Ensure that the getHumanAge function aligns with this logic.

Copy link
Author

Choose a reason for hiding this comment

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

done


test('animals` human age should be 1 if their own age > 14 and < 24', () => {
expect(getHumanAge(15, 23)).toEqual([1, 1]);
});

Choose a reason for hiding this comment

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

The test description and expectation are consistent for ages between 15 and 23. Verify that the getHumanAge function implements this logic correctly.

Copy link
Author

Choose a reason for hiding this comment

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

done


test(`cat's age should add 1 every 4 years after 23 years old
dog's age should add 1 every 5 years after 23 years old`, () => {
expect(getHumanAge(24, 24)).toEqual([2, 2]);
expect(getHumanAge(27, 28)).toEqual([2, 2]);
expect(getHumanAge(31, 33)).toEqual([3, 3]);
expect(getHumanAge(59, 59)).toEqual([10, 9]);
expect(getHumanAge(47, 88)).toEqual([7, 14]);
});

Choose a reason for hiding this comment

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

The logic described in the test case for ages after 23 might be incorrect or misunderstood. Ensure that the getHumanAge function correctly implements the logic where a cat's age adds 1 every 4 years and a dog's age adds 1 every 5 years after 23 years old. The expectations in the test cases should reflect this logic accurately.

});