odin-javascript-exercises/12 findTheOldest/findTheOldest.spec.js
Benjo Kho 55cfb173d8 Order exercise folders
Ordered the exercise folders by placing their numbers in their folder name
2021-08-07 14:21:26 +08:00

62 lines
1.3 KiB
JavaScript

const findTheOldest = require('./findTheOldest')
describe('findTheOldest', () => {
test('finds the oldest person!', () => {
const people = [
{
name: "Carly",
yearOfBirth: 1942,
yearOfDeath: 1970,
},
{
name: "Ray",
yearOfBirth: 1962,
yearOfDeath: 2011,
},
{
name: "Jane",
yearOfBirth: 1912,
yearOfDeath: 1941,
},
]
expect(findTheOldest(people).name).toBe('Ray');
});
test.skip('finds the oldest person if someone is still living', () => {
const people = [
{
name: "Carly",
yearOfBirth: 2018,
},
{
name: "Ray",
yearOfBirth: 1962,
yearOfDeath: 2011,
},
{
name: "Jane",
yearOfBirth: 1912,
yearOfDeath: 1941,
},
]
expect(findTheOldest(people).name).toBe('Ray');
});
test.skip('finds the oldest person if the OLDEST is still living', () => {
const people = [
{
name: "Carly",
yearOfBirth: 1066,
},
{
name: "Ray",
yearOfBirth: 1962,
yearOfDeath: 2011,
},
{
name: "Jane",
yearOfBirth: 1912,
yearOfDeath: 1941,
},
]
expect(findTheOldest(people).name).toBe('Carly');
});
});