/js_cat_and_dogs_years

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Write a tests for the function getHumanAge which accepts two integers catAge and dogAge and converts 'animal' age into 'human' age. The function returns an array, where the first element is 'human' age of the cat and the second element is 'human' age of the dog.

There is the rules how calculate the 'human' age:

Cat age:
15 human years for first cat year
+9 human years for second cat year
+4 human years for each cat year after that

Dog age:
15 human years for first dog year
+9 human years for second dog year
+5 human years for each dog year after that

Examples:

getHumanAge(9, 8) === [0, 0]
getHumanAge(15, 24) === [1, 2]
getHumanAge(28, 44) === [3, 6]

Guideline

Read more about Jest expectations