From f3a6283a93c976bce5901760194d0a064452f69b Mon Sep 17 00:00:00 2001 From: DonRehan <30264386+donRehan@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:16:03 +0200 Subject: [PATCH 1/2] 12_findTheOldest fix ambiguity and remove redundant test description fix ambiguity in test description , old was 'finds the person with the greatest age if someone is still living.' remove redundant test that checks for 'finds the person with the greatest age if the OLDEST is still living' since both this and the above test for ability to check if there is no death year field. --- 12_findTheOldest/findTheOldest.spec.js | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/12_findTheOldest/findTheOldest.spec.js b/12_findTheOldest/findTheOldest.spec.js index 732faaa3bce..4f07887acc2 100644 --- a/12_findTheOldest/findTheOldest.spec.js +++ b/12_findTheOldest/findTheOldest.spec.js @@ -21,26 +21,7 @@ describe('findTheOldest', () => { ] expect(findTheOldest(people).name).toBe('Ray'); }); - test.skip('finds the person with the greatest age 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 person with the greatest age if the OLDEST is still living', () => { + test('finds the oldest person if yearOfDeath field is not present', () => { const people = [ { name: "Carly", From 8bc6e47821b8df0ba544cf9bc9bf8e14eeeceb5b Mon Sep 17 00:00:00 2001 From: DonRehan <30264386+donRehan@users.noreply.github.com> Date: Mon, 12 Feb 2024 14:36:33 +0200 Subject: [PATCH 2/2] Update findTheOldest test to clear ambiguity --- 12_findTheOldest/findTheOldest.spec.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/12_findTheOldest/findTheOldest.spec.js b/12_findTheOldest/findTheOldest.spec.js index 4f07887acc2..aac207cea21 100644 --- a/12_findTheOldest/findTheOldest.spec.js +++ b/12_findTheOldest/findTheOldest.spec.js @@ -21,7 +21,26 @@ describe('findTheOldest', () => { ] expect(findTheOldest(people).name).toBe('Ray'); }); - test('finds the oldest person if yearOfDeath field is not present', () => { + test.skip('finds the oldest person if yearOfDeath field is undefined on a non-oldest person', () => { + 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 yearOfDeath field is undefined for the oldest person', () => { const people = [ { name: "Carly",