Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js test #623

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/getHumanAge.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-len */
'use strict';

describe('getHumanAge', () => {
Expand All @@ -7,4 +8,53 @@ describe('getHumanAge', () => {
expect(getHumanAge)
.toBeInstanceOf(Function);
});

test('if catAge & dogAge is zero, should return [0, 0] ', () => {
const result = getHumanAge(0, 0);

expect(result).toEqual([0, 0]);
});

test('if catAge & dogAge is less than 15, should return [0, 0] ', () => {
const result = getHumanAge(14, 14);

expect(result).toEqual([0, 0]);
});

test('if catAge & dogAge is 15, should return [1, 1] ', () => {
const result = getHumanAge(15, 15);

expect(result).toEqual([1, 1]);
});

test('if catAge & dogAge is more than 15 but less than 24, should return [1, 1]',
() => {
const result = getHumanAge(23, 23);

expect(result).toEqual([1, 1]);
});

test('if catAge & dogAge is 24, should return [2, 2]', () => {
const result = getHumanAge(24, 24);

expect(result).toEqual([2, 2]);
});

test('if catAge & dogAge is 27, should return [2, 2]', () => {
const result = getHumanAge(27, 27);

expect(result).toEqual([2, 2]);
});

test('if catAge & dogAge is 28, should return [3, 2]', () => {
const result = getHumanAge(28, 28);

expect(result).toEqual([3, 2]);
});

test('if catAge & dogAge is 100, should return [21, 17]', () => {
const result = getHumanAge(100, 100);

expect(result).toEqual([21, 17]);
});
});