From 1688409d80f41d7ac1eeada8dc72acbdd7f95629 Mon Sep 17 00:00:00 2001 From: Lishchuk Timofii Date: Sat, 16 Nov 2024 18:02:31 +0200 Subject: [PATCH] Solution v1 --- package.json | 2 +- src/getHumanAge.test.js | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5081bc97..6b0dde61 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test:only": "mate-scripts test", "update": "mate-scripts update", "postinstall": "npm run update", - "test": "npm run lint && npm run test:only" + "test": "jest" }, "author": "Mate academy", "license": "GPL-3.0", diff --git a/src/getHumanAge.test.js b/src/getHumanAge.test.js index 6ce3e586..fa2d9202 100644 --- a/src/getHumanAge.test.js +++ b/src/getHumanAge.test.js @@ -6,5 +6,37 @@ describe('getHumanAge', () => { test('should be declared', () => { expect(getHumanAge) .toBeInstanceOf(Function); - }); +}); + +test('Should return [0, 0] for (0, 0)', () => { + expect(getHumanAge(0, 0)).toEqual([0, 0]); +}); + +test('should return [0, 0] for (14, 14)', () => { + expect(getHumanAge(14, 14)).toEqual([0, 0]) +}); + +test('should return [1, 1] for (15, 15)', () => { + expect(getHumanAge(15, 15)).toEqual([1, 1]) +}); + +test('should return [1, 1] for (23, 23)', () => { + expect(getHumanAge(23, 23)).toEqual([1, 1]) +}); + +test('should return [2, 2] for (24, 24)', () => { + expect(getHumanAge(24, 24)).toEqual([2, 2]) +}); + +test('should return [2, 2] for (27, 27)', () => { + expect(getHumanAge(27, 27)).toEqual([2, 2]) +}); + +test('should return [3, 2] for (28, 27)', () => { + expect(getHumanAge(28, 27)).toEqual([3, 2]) +}); + +test('should return [21, 17] for (100, 100)', () => { + expect(getHumanAge(100, 100)).toEqual([21, 17]) +}); });