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

add solution #638

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
35 changes: 35 additions & 0 deletions src/getHumanAge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,40 @@ describe('getHumanAge', () => {
test('should be declared', () => {
expect(getHumanAge)
.toBeInstanceOf(Function);
expect(getHumanAge).toBeInstanceOf(Function);
Comment on lines 7 to +9

Choose a reason for hiding this comment

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

The line expect(getHumanAge).toBeInstanceOf(Function); is duplicated. You should remove one of these lines to avoid redundancy.

});

test('should return an array', () => {
expect(getHumanAge(28, 28)).toBeInstanceOf(Array);
});

test('should return [0, 0] for catAge and dogAge being 0 or less than 15',
() => {
expect(getHumanAge(14, 14)).toEqual([0, 0]);
});

test(
'should return [1, 1] for catAge and dogAge being 15 or less than 24',
() => {
expect(getHumanAge(15, 15)).toEqual([1, 1]);
});

test(
'should return [2, 2] for catAge and dogAge being 24 and between 24 and 27',
() => {
expect(getHumanAge(24, 24)).toEqual([2, 2]);
});

test('should return [3, 2] for catAge being 28 and dogAge being 28', () => {
expect(getHumanAge(28, 28)).toEqual([3, 2]);
});

test('should return [21, 17] for catAge and dogAge being 100', () => {
expect(getHumanAge(100, 100)).toEqual([21, 17]);
});

test('should handle mixed catAge and dogAge values correctly', () => {
expect(getHumanAge(14, 15)).toEqual([0, 1]);
expect(getHumanAge(24, 28)).toEqual([2, 2]);
});
});