2021-05-08 11:28:50 -07:00
|
|
|
let findTheOldest = require('./findTheOldest')
|
2019-04-11 10:00:21 -07:00
|
|
|
|
2021-05-08 11:28:50 -07:00
|
|
|
describe('findTheOldest', function() {
|
|
|
|
it('finds the oldest person!', function() {
|
2019-04-11 10:00:21 -07:00
|
|
|
const people = [
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Carly",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1942,
|
|
|
|
yearOfDeath: 1970,
|
|
|
|
},
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Ray",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1962,
|
2021-05-08 11:25:04 -07:00
|
|
|
yearOfDeath: 2011,
|
2019-04-11 10:00:21 -07:00
|
|
|
},
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Jane",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1912,
|
2021-05-08 11:25:04 -07:00
|
|
|
yearOfDeath: 1941,
|
2019-04-11 10:00:21 -07:00
|
|
|
},
|
2021-05-08 11:28:50 -07:00
|
|
|
]
|
|
|
|
expect(findTheOldest(people).name).toEqual('Ray');
|
2019-04-11 10:00:21 -07:00
|
|
|
});
|
2021-05-08 11:28:50 -07:00
|
|
|
xit('finds the oldest person if someone is still living', function() {
|
2019-04-11 10:00:21 -07:00
|
|
|
const people = [
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Carly",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 2018,
|
|
|
|
},
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Ray",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1962,
|
2021-05-08 11:25:04 -07:00
|
|
|
yearOfDeath: 2011,
|
2019-04-11 10:00:21 -07:00
|
|
|
},
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Jane",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1912,
|
2021-05-08 11:25:04 -07:00
|
|
|
yearOfDeath: 1941,
|
2019-04-11 10:00:21 -07:00
|
|
|
},
|
2021-05-08 11:28:50 -07:00
|
|
|
]
|
|
|
|
expect(findTheOldest(people).name).toEqual('Ray');
|
2019-04-11 10:00:21 -07:00
|
|
|
});
|
2021-05-08 11:28:50 -07:00
|
|
|
xit('finds the oldest person if the OLDEST is still living', function() {
|
2019-04-11 10:00:21 -07:00
|
|
|
const people = [
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Carly",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1066,
|
|
|
|
},
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Ray",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1962,
|
2021-05-08 11:25:04 -07:00
|
|
|
yearOfDeath: 2011,
|
2019-04-11 10:00:21 -07:00
|
|
|
},
|
|
|
|
{
|
2021-05-08 11:25:04 -07:00
|
|
|
name: "Jane",
|
2019-04-11 10:00:21 -07:00
|
|
|
yearOfBirth: 1912,
|
2021-05-08 11:25:04 -07:00
|
|
|
yearOfDeath: 1941,
|
2019-04-11 10:00:21 -07:00
|
|
|
},
|
2021-05-08 11:28:50 -07:00
|
|
|
]
|
|
|
|
expect(findTheOldest(people).name).toEqual('Carly');
|
2019-04-11 10:00:21 -07:00
|
|
|
});
|
|
|
|
});
|