From 68a5b93785ae532b7027f3ff7f49102203d017c1 Mon Sep 17 00:00:00 2001 From: myemets Date: Thu, 16 Jan 2025 16:31:50 +0200 Subject: [PATCH] add solution --- src/getHumanAge.test.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/getHumanAge.test.js b/src/getHumanAge.test.js index 6ce3e586..b727882b 100644 --- a/src/getHumanAge.test.js +++ b/src/getHumanAge.test.js @@ -6,5 +6,40 @@ describe('getHumanAge', () => { test('should be declared', () => { expect(getHumanAge) .toBeInstanceOf(Function); + expect(getHumanAge).toBeInstanceOf(Function); + }); + + 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]); }); });