From d5cdea71dd3c09ba0f08ee8dd1d1b3f3d903514b Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 15 Nov 2024 17:17:18 +0200 Subject: [PATCH] Solution --- package.json | 2 +- src/getHumanAge.test.js | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 5081bc97..81238407 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "license": "GPL-3.0", "devDependencies": { "@mate-academy/eslint-config": "*", - "@mate-academy/scripts": "^0.9.14", + "@mate-academy/scripts": "^1.9.12", "eslint": "^5.16.0", "eslint-plugin-jest": "^22.4.1", "eslint-plugin-node": "^8.0.1", diff --git a/src/getHumanAge.test.js b/src/getHumanAge.test.js index 6ce3e586..2dcdaa2a 100644 --- a/src/getHumanAge.test.js +++ b/src/getHumanAge.test.js @@ -1,10 +1,29 @@ -'use strict'; +"use strict"; -describe('getHumanAge', () => { - const { getHumanAge } = require('./getHumanAge'); +describe("getHumanAge", () => { + const { getHumanAge } = require("./getHumanAge"); - test('should be declared', () => { - expect(getHumanAge) - .toBeInstanceOf(Function); + test("should be declared", () => { + expect(getHumanAge).toBeInstanceOf(Function); + }); + + test("should return [0, 0] for ages (0, 0)", () => { + expect(getHumanAge(0, 0)).toEqual([0, 0]); + }); + + test("should return [1, 1] for ages (15, 15)", () => { + expect(getHumanAge(15, 15)).toEqual([1, 1]); + }); + + test("should return [2, 2] for ages (24, 24)", () => { + expect(getHumanAge(24, 24)).toEqual([2, 2]); + }); + + test("should return [3, 2] for ages (28, 28)", () => { + expect(getHumanAge(28, 28)).toEqual([3, 2]); + }); + + test("should return [21, 17] for ages (100, 100)", () => { + expect(getHumanAge(100, 100)).toEqual([21, 17]); }); });