From b15664ec9b7a3189ad844a85ce94353265d29778 Mon Sep 17 00:00:00 2001 From: VVladLytvyn <1997vlad1997bob@gmail.com> Date: Sat, 16 Nov 2024 13:40:04 +0200 Subject: [PATCH 1/2] solution --- src/getHumanAge.test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/getHumanAge.test.js b/src/getHumanAge.test.js index 6ce3e586..218a470d 100644 --- a/src/getHumanAge.test.js +++ b/src/getHumanAge.test.js @@ -7,4 +7,36 @@ describe('getHumanAge', () => { expect(getHumanAge) .toBeInstanceOf(Function); }); + + test('should return an array', () => { + expect(getHumanAge()) + .toBeInstanceOf(Array); + }); + + test('should return a numbers inside of array ', () => { + const result = getHumanAge(4, 4); + + expect(typeof result[0]).toBe('number'); + expect(typeof result[1]).toBe('number'); + }); + + test('should have length 2 for input 2 args', () => { + expect(getHumanAge(1, 13)) + .toHaveLength(2); + }); + + test('should return 14, 14 for 0, 0 inputs', () => { + expect(getHumanAge(0, 0)) + .toEqual([0, 0]); + }); + + test('should return 1, 1 for inputs 15, 15', () => { + expect(getHumanAge(15, 15)) + .toEqual([1, 1]); + }); + + test('should return 100, 100 for 21, 17', () => { + expect(getHumanAge(100, 100)) + .toEqual([21, 17]); + }); }); From 4e396f7ac68f30eb0438020ace56e2483afca3fb Mon Sep 17 00:00:00 2001 From: VVladLytvyn <1997vlad1997bob@gmail.com> Date: Sat, 16 Nov 2024 14:08:58 +0200 Subject: [PATCH 2/2] solution-1 --- src/getHumanAge.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/getHumanAge.test.js b/src/getHumanAge.test.js index 218a470d..eeb9529f 100644 --- a/src/getHumanAge.test.js +++ b/src/getHumanAge.test.js @@ -25,17 +25,17 @@ describe('getHumanAge', () => { .toHaveLength(2); }); - test('should return 14, 14 for 0, 0 inputs', () => { + test('should return 0, 0 for 0, 0 inputs', () => { expect(getHumanAge(0, 0)) .toEqual([0, 0]); }); - test('should return 1, 1 for inputs 15, 15', () => { + test('should return [1, 1] for inputs 15, 15', () => { expect(getHumanAge(15, 15)) .toEqual([1, 1]); }); - test('should return 100, 100 for 21, 17', () => { + test('should return [21, 17] for inputs 100, 100', () => { expect(getHumanAge(100, 100)) .toEqual([21, 17]); });