2021-03-09 11:12:25 +00:00
|
|
|
const findTheOldest = require('./findTheOldest')
|
2019-04-11 17:00:21 +00:00
|
|
|
|
2021-03-09 11:12:25 +00:00
|
|
|
describe('findTheOldest', () => {
|
|
|
|
test('finds the oldest person!', () => {
|
2019-04-11 17:00:21 +00:00
|
|
|
const people = [
|
|
|
|
{
|
|
|
|
name: 'Carly',
|
|
|
|
yearOfBirth: 1942,
|
|
|
|
yearOfDeath: 1970,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Ray',
|
|
|
|
yearOfBirth: 1962,
|
|
|
|
yearOfDeath: 2011
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Jane',
|
|
|
|
yearOfBirth: 1912,
|
|
|
|
yearOfDeath: 1941
|
|
|
|
},
|
|
|
|
]
|
2021-03-09 11:12:25 +00:00
|
|
|
expect(findTheOldest(people).name).toBe('Ray');
|
2019-04-11 17:00:21 +00:00
|
|
|
});
|
2021-03-09 11:12:25 +00:00
|
|
|
test.skip('finds the oldest person if someone is still living', () => {
|
2019-04-11 17:00:21 +00:00
|
|
|
const people = [
|
|
|
|
{
|
|
|
|
name: 'Carly',
|
|
|
|
yearOfBirth: 2018,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Ray',
|
|
|
|
yearOfBirth: 1962,
|
|
|
|
yearOfDeath: 2011
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Jane',
|
|
|
|
yearOfBirth: 1912,
|
|
|
|
yearOfDeath: 1941
|
|
|
|
},
|
|
|
|
]
|
2021-03-09 11:12:25 +00:00
|
|
|
expect(findTheOldest(people).name).toBe('Ray');
|
2019-04-11 17:00:21 +00:00
|
|
|
});
|
2021-03-09 11:12:25 +00:00
|
|
|
test.skip('finds the oldest person if the OLDEST is still living', () => {
|
2019-04-11 17:00:21 +00:00
|
|
|
const people = [
|
|
|
|
{
|
|
|
|
name: 'Carly',
|
|
|
|
yearOfBirth: 1066,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Ray',
|
|
|
|
yearOfBirth: 1962,
|
|
|
|
yearOfDeath: 2011
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Jane',
|
|
|
|
yearOfBirth: 1912,
|
|
|
|
yearOfDeath: 1941
|
|
|
|
},
|
|
|
|
]
|
2021-03-09 11:12:25 +00:00
|
|
|
expect(findTheOldest(people).name).toBe('Carly');
|
2019-04-11 17:00:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2019-04-11 17:11:03 +00:00
|
|
|
|