2021-03-03 02:13:24 +00:00
|
|
|
const findTheOldest = require('./findTheOldest')
|
2019-04-11 17:00:21 +00:00
|
|
|
|
2021-03-03 02:13:24 +00:00
|
|
|
describe('findTheOldest', () => {
|
2023-04-07 00:41:30 +00:00
|
|
|
test('finds the person with the greatest age!', () => {
|
2019-04-11 17:00:21 +00:00
|
|
|
const people = [
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Carly",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1942,
|
|
|
|
yearOfDeath: 1970,
|
|
|
|
},
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Ray",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1962,
|
2021-05-08 18:25:04 +00:00
|
|
|
yearOfDeath: 2011,
|
2019-04-11 17:00:21 +00:00
|
|
|
},
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Jane",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1912,
|
2021-05-08 18:25:04 +00:00
|
|
|
yearOfDeath: 1941,
|
2019-04-11 17:00:21 +00:00
|
|
|
},
|
|
|
|
]
|
2021-03-03 02:13:24 +00:00
|
|
|
expect(findTheOldest(people).name).toBe('Ray');
|
2019-04-11 17:00:21 +00:00
|
|
|
});
|
2023-04-07 00:41:30 +00:00
|
|
|
test.skip('finds the person with the greatest age if someone is still living', () => {
|
2019-04-11 17:00:21 +00:00
|
|
|
const people = [
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Carly",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 2018,
|
|
|
|
},
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Ray",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1962,
|
2021-05-08 18:25:04 +00:00
|
|
|
yearOfDeath: 2011,
|
2019-04-11 17:00:21 +00:00
|
|
|
},
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Jane",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1912,
|
2021-05-08 18:25:04 +00:00
|
|
|
yearOfDeath: 1941,
|
2019-04-11 17:00:21 +00:00
|
|
|
},
|
|
|
|
]
|
2021-03-03 02:13:24 +00:00
|
|
|
expect(findTheOldest(people).name).toBe('Ray');
|
2019-04-11 17:00:21 +00:00
|
|
|
});
|
2023-04-07 00:41:30 +00:00
|
|
|
test.skip('finds the person with the greatest age if the OLDEST is still living', () => {
|
2019-04-11 17:00:21 +00:00
|
|
|
const people = [
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Carly",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1066,
|
|
|
|
},
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Ray",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1962,
|
2021-05-08 18:25:04 +00:00
|
|
|
yearOfDeath: 2011,
|
2019-04-11 17:00:21 +00:00
|
|
|
},
|
|
|
|
{
|
2021-05-08 18:25:04 +00:00
|
|
|
name: "Jane",
|
2019-04-11 17:00:21 +00:00
|
|
|
yearOfBirth: 1912,
|
2021-05-08 18:25:04 +00:00
|
|
|
yearOfDeath: 1941,
|
2019-04-11 17:00:21 +00:00
|
|
|
},
|
|
|
|
]
|
2021-03-03 02:13:24 +00:00
|
|
|
expect(findTheOldest(people).name).toBe('Carly');
|
2019-04-11 17:00:21 +00:00
|
|
|
});
|
|
|
|
});
|