From c3cc796723c636f71a9a27b2f08b4dfdac7ecbb2 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 10:16:33 +0100 Subject: [PATCH 01/27] refactor: update formatAs12HourClock function to improve time parsing and period handling --- format-clock-edge-cases/timeConverter.js | 31 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 310c07bd9..5c54f88ed 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -1,11 +1,28 @@ -function formatAs12HourClock(time) { +// function formatAs12HourClock(time) { - const hours = Number(time.slice(0, 2)); +// const hours = Number(time.slice(0, 2)); - if (hours > 12) { - return `${hours - 12}:00 pm`; +// if (hours > 12) { +// return `${hours - 12}:00 pm`; +// } +// return `${time} am`; +// } + +// export {formatAs12HourClock}; + +function formatAs12HourClock(time){ + const [hourPart, minutePart] = time.split(":"); + const hours = Number(hourPart); + + let period; + if(hours < 12){ + period = "am"; + } else { + period = "pm"; } - return `${time} am`; -} -export {formatAs12HourClock}; + let displayHour = hours % 12; + if(displayHour === 0){ + displayHour = 12; + } +} From b03e0fbd6025ddf479c53fda059c6782d01a865a Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 10:43:31 +0100 Subject: [PATCH 02/27] refactor: update test syntax to use arrow functions for consistency --- format-clock-edge-cases/timeConverter.test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 88f2af094..87ebf6f0d 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -2,10 +2,13 @@ import {formatAs12HourClock} from "./timeConverter.js"; import assert from "node:assert"; import test from "node:test"; -test("correctly convert time after 12:00", function(){ +test("correctly convert time after 12:00", () => { assert.equal(formatAs12HourClock("23:00"), "11:00 pm"); }); -test("can correctly convert morning time", function() { +test("can correctly convert morning time", () => { assert.equal(formatAs12HourClock("08:00"), "08:00 am"); }); +test("converts a single-digit morning hour and drops leading zero", () => { + assert.equal(formatAs12HourClock("08:00"), "8:00am"); +}) \ No newline at end of file From 05e8ef311bd3e4cd59181cb6001f96f960649d76 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 10:44:14 +0100 Subject: [PATCH 03/27] fix: ensure formatAs12HourClock function exports correctly --- format-clock-edge-cases/timeConverter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 5c54f88ed..cfc15cf0d 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -26,3 +26,4 @@ function formatAs12HourClock(time){ displayHour = 12; } } +export {formatAs12HourClock}; From 1544b3863f7bc83092b1a3779f123901ddae1f13 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 10:47:01 +0100 Subject: [PATCH 04/27] test: add test case for converting midnight time --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 87ebf6f0d..958577764 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -11,4 +11,7 @@ test("can correctly convert morning time", () => { }); test("converts a single-digit morning hour and drops leading zero", () => { assert.equal(formatAs12HourClock("08:00"), "8:00am"); +}) +test("converts correctly to midnight", () => { + assert.equal(formatAs12HourClock("00:00"), "12:00am"); }) \ No newline at end of file From 8230a0e18ffb9f272d44bd8d3022cb0648cfb923 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 12:08:19 +0100 Subject: [PATCH 05/27] refactor: improve time conversion logic and enhance test cases for clarity --- format-clock-edge-cases/timeConverter.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 958577764..526b54add 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -12,6 +12,9 @@ test("can correctly convert morning time", () => { test("converts a single-digit morning hour and drops leading zero", () => { assert.equal(formatAs12HourClock("08:00"), "8:00am"); }) -test("converts correctly to midnight", () => { +test("converts exactly to midnight", () => { assert.equal(formatAs12HourClock("00:00"), "12:00am"); +}) +test("converts time just after midnight", () => { + assert.equal(formatAs12HourClock("00:30"), "12:30am"); }) \ No newline at end of file From ead95df8677dafc76d86a95af0136c91a71aa890 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 12:08:43 +0100 Subject: [PATCH 06/27] fix: correct return statement in formatAs12HourClock function for accurate time formatting --- format-clock-edge-cases/timeConverter.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index cfc15cf0d..8c790c71e 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -25,5 +25,7 @@ function formatAs12HourClock(time){ if(displayHour === 0){ displayHour = 12; } + return `${displayHour}:${minutePart} ${period}` } export {formatAs12HourClock}; +console.log(formatAs12HourClock("24:00")) From 19e10f50ad39a1576e23461bad31f26c6d514ab2 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 12:10:41 +0100 Subject: [PATCH 07/27] test: add test case for converting the last minute before noon --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 526b54add..1439f3645 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -17,4 +17,7 @@ test("converts exactly to midnight", () => { }) test("converts time just after midnight", () => { assert.equal(formatAs12HourClock("00:30"), "12:30am"); +}) +test("converts the last minute before noon", () => { + assert.equal(formatAs12HourClock("11:59"), "11:59am"); }) \ No newline at end of file From 15938a2f6f3dba6ac81a0574486468eeedf2f395 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 12:17:57 +0100 Subject: [PATCH 08/27] test: add test case for converting exact noon to pm --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 1439f3645..d17001510 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -20,4 +20,7 @@ test("converts time just after midnight", () => { }) test("converts the last minute before noon", () => { assert.equal(formatAs12HourClock("11:59"), "11:59am"); +}) +test("converts exact noon to pm", () => { + assert.equal(formatAs12HourClock("12:00"), "12:00pm"); }) \ No newline at end of file From 8acdeaac7b1ecf042a74ecbac66df04d501780de Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 12:24:44 +0100 Subject: [PATCH 09/27] test: add test case for converting time just after noon --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index d17001510..e6de2a0ae 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -23,4 +23,7 @@ test("converts the last minute before noon", () => { }) test("converts exact noon to pm", () => { assert.equal(formatAs12HourClock("12:00"), "12:00pm"); +}) +test("convert time just after noon", () => { + assert.equal(formatAs12HourClock("12:30"), "12:30pm"); }) \ No newline at end of file From a7d1115808deaf5f887c330cd6b91d9ab1327965 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 12:31:15 +0100 Subject: [PATCH 10/27] fix: add missing newline at end of timeConverter.test.js --- format-clock-edge-cases/timeConverter.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index e6de2a0ae..5c77479ae 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -26,4 +26,4 @@ test("converts exact noon to pm", () => { }) test("convert time just after noon", () => { assert.equal(formatAs12HourClock("12:30"), "12:30pm"); -}) \ No newline at end of file +}) From ee8f85b58e813844d51c47595bfbdfc698cd94f3 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:13:43 +0100 Subject: [PATCH 11/27] fix: remove space before am/pm in time formatting and clean up test cases --- format-clock-edge-cases/timeConverter.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 5c77479ae..35f0353f3 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -3,12 +3,9 @@ import assert from "node:assert"; import test from "node:test"; test("correctly convert time after 12:00", () => { - assert.equal(formatAs12HourClock("23:00"), "11:00 pm"); + assert.equal(formatAs12HourClock("23:00"), "11:00pm"); }); -test("can correctly convert morning time", () => { - assert.equal(formatAs12HourClock("08:00"), "08:00 am"); -}); test("converts a single-digit morning hour and drops leading zero", () => { assert.equal(formatAs12HourClock("08:00"), "8:00am"); }) @@ -27,3 +24,6 @@ test("converts exact noon to pm", () => { test("convert time just after noon", () => { assert.equal(formatAs12HourClock("12:30"), "12:30pm"); }) +test("converts the first afternoon hour", () => { + assert.equal(formatAs12HourClock("13:00"), "1:30pm"); +}) \ No newline at end of file From f93cd35b0045c49fcd1009cf6b44e0d6bdf86104 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:13:53 +0100 Subject: [PATCH 12/27] fix: remove space before period in time formatting --- format-clock-edge-cases/timeConverter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 8c790c71e..2838957f9 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -25,7 +25,7 @@ function formatAs12HourClock(time){ if(displayHour === 0){ displayHour = 12; } - return `${displayHour}:${minutePart} ${period}` + return `${displayHour}:${minutePart}${period}`; } export {formatAs12HourClock}; console.log(formatAs12HourClock("24:00")) From 59863c5e7088f6732b3ef324778de64c1f8a6e9d Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:15:29 +0100 Subject: [PATCH 13/27] test: add test case for converting late evening hour --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 35f0353f3..3e85ff048 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -26,4 +26,7 @@ test("convert time just after noon", () => { }) test("converts the first afternoon hour", () => { assert.equal(formatAs12HourClock("13:00"), "1:30pm"); +}) +test("converts late evening hour", () => { + assert.equal(formatAs12HourClock("23:00"), "11:00pm"); }) \ No newline at end of file From c6ed571c83cfb10cf15f19c3a8f1e55ce0b9e62e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:18:46 +0100 Subject: [PATCH 14/27] test: add test case for converting last minute of the day --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 3e85ff048..e35005af7 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -29,4 +29,7 @@ test("converts the first afternoon hour", () => { }) test("converts late evening hour", () => { assert.equal(formatAs12HourClock("23:00"), "11:00pm"); +}) +test("converts last minute of the day", () => { + assert.equal(formatAs12HourClock("23:59"), "11:59pm"); }) \ No newline at end of file From ced1c53a2856d38caa69fe7991ffe0447aa69f6a Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:21:23 +0100 Subject: [PATCH 15/27] fix: correct expected output for first afternoon hour test case --- format-clock-edge-cases/timeConverter.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index e35005af7..95e2dbb63 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -25,7 +25,7 @@ test("convert time just after noon", () => { assert.equal(formatAs12HourClock("12:30"), "12:30pm"); }) test("converts the first afternoon hour", () => { - assert.equal(formatAs12HourClock("13:00"), "1:30pm"); + assert.equal(formatAs12HourClock("13:00"), "1:00pm"); }) test("converts late evening hour", () => { assert.equal(formatAs12HourClock("23:00"), "11:00pm"); From 9f0876ffc3e682040df0d6091c22839210580481 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:27:19 +0100 Subject: [PATCH 16/27] test: add test case for preserving minutes with leading zero --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index 95e2dbb63..dde4dfa88 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -32,4 +32,7 @@ test("converts late evening hour", () => { }) test("converts last minute of the day", () => { assert.equal(formatAs12HourClock("23:59"), "11:59pm"); +}) +test("preserves minutes with leading zero", () => { + assert.equal(formatAs12HourClock("09:05"), "9:05am"); }) \ No newline at end of file From 03c860be74f1e4f038572dc3980050112046c4b1 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:27:33 +0100 Subject: [PATCH 17/27] test: update console log to test formatting for 8:00 AM --- format-clock-edge-cases/timeConverter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 2838957f9..40878c68b 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -28,4 +28,4 @@ function formatAs12HourClock(time){ return `${displayHour}:${minutePart}${period}`; } export {formatAs12HourClock}; -console.log(formatAs12HourClock("24:00")) +console.log(formatAs12HourClock("08:00")) From 42d563c84ef7e1dcf86cab68f30941cf2a71ade8 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:29:00 +0100 Subject: [PATCH 18/27] test: add test case for preserving non-zero minutes --- format-clock-edge-cases/timeConverter.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index dde4dfa88..ac64852b1 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -35,4 +35,7 @@ test("converts last minute of the day", () => { }) test("preserves minutes with leading zero", () => { assert.equal(formatAs12HourClock("09:05"), "9:05am"); +}) +test("preserves non-zero minutes", () => { + assert.equal(formatAs12HourClock("14:45"), "2:45pm"); }) \ No newline at end of file From 91ccb0c1655a452efe960dc0a75650fb536d6fa5 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sat, 3 Oct 2026 14:30:09 +0100 Subject: [PATCH 19/27] test: update console log to test formatting for 8:40 AM --- format-clock-edge-cases/timeConverter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 40878c68b..d941da6e8 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -28,4 +28,4 @@ function formatAs12HourClock(time){ return `${displayHour}:${minutePart}${period}`; } export {formatAs12HourClock}; -console.log(formatAs12HourClock("08:00")) +console.log(formatAs12HourClock("08:40")) From 472364d3f324bd4b18bbaa78fb5c97722fd6a67c Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sun, 4 Oct 2026 20:15:21 +0100 Subject: [PATCH 20/27] Remove commented-out code from time formatting function --- format-clock-edge-cases/timeConverter.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index d941da6e8..f1b5ec631 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -1,15 +1,3 @@ -// function formatAs12HourClock(time) { - -// const hours = Number(time.slice(0, 2)); - -// if (hours > 12) { -// return `${hours - 12}:00 pm`; -// } -// return `${time} am`; -// } - -// export {formatAs12HourClock}; - function formatAs12HourClock(time){ const [hourPart, minutePart] = time.split(":"); const hours = Number(hourPart); From 5b48a96d3f7f884310efe101d4d0a8ed424c055e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sun, 4 Oct 2026 20:20:48 +0100 Subject: [PATCH 21/27] Remove console log from time formatting function --- format-clock-edge-cases/timeConverter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index f1b5ec631..897565f28 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -16,4 +16,3 @@ function formatAs12HourClock(time){ return `${displayHour}:${minutePart}${period}`; } export {formatAs12HourClock}; -console.log(formatAs12HourClock("08:40")) From 8a740151f986648e6da5fce04705d20d0e61d51d Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sun, 4 Oct 2026 20:26:11 +0100 Subject: [PATCH 22/27] Add jsconfig.json for TypeScript configuration --- jsconfig.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 jsconfig.json diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 000000000..ce3653908 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "Bundler", + "target": "ES2024", + "jsx": "react-jsx", + "allowImportingTsExtensions": true, + "checkJs": undefined, + "experimentalDecorators": false, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strict": true + }, + "exclude": [ + "node_modules", + "**/node_modules/*" + ] +} \ No newline at end of file From 27919c8ba64b659942665e79d3a9c1873fd0cf08 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Sun, 4 Oct 2026 20:43:28 +0100 Subject: [PATCH 23/27] Format code and improve readability --- .prettierrc | 1 - format-clock-edge-cases/timeConverter.js | 2 +- format-clock-edge-cases/timeConverter.test.js | 48 +++++++++---------- .../3-get-card-value.test.js | 6 ++- .../3-get-card-value.test.js | 1 - package.json | 5 +- practice-tdd/count.js | 2 +- .../password-validator.test.js | 15 +++--- 8 files changed, 42 insertions(+), 38 deletions(-) diff --git a/.prettierrc b/.prettierrc index 59bb3b44f..2e7e49095 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,6 @@ "embeddedLanguageFormatting": "auto", "htmlWhitespaceSensitivity": "css", "insertPragma": false, - "jsxBracketSameLine": false, "jsxSingleQuote": false, "printWidth": 80, "proseWrap": "preserve", diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 897565f28..389d4fad8 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -5,7 +5,7 @@ function formatAs12HourClock(time){ let period; if(hours < 12){ period = "am"; - } else { + }else{ period = "pm"; } diff --git a/format-clock-edge-cases/timeConverter.test.js b/format-clock-edge-cases/timeConverter.test.js index ac64852b1..bc3a9a933 100644 --- a/format-clock-edge-cases/timeConverter.test.js +++ b/format-clock-edge-cases/timeConverter.test.js @@ -1,41 +1,41 @@ -import {formatAs12HourClock} from "./timeConverter.js"; +import { formatAs12HourClock } from "./timeConverter.js"; import assert from "node:assert"; import test from "node:test"; test("correctly convert time after 12:00", () => { - assert.equal(formatAs12HourClock("23:00"), "11:00pm"); + assert.equal(formatAs12HourClock("23:00"), "11:00pm"); }); test("converts a single-digit morning hour and drops leading zero", () => { - assert.equal(formatAs12HourClock("08:00"), "8:00am"); -}) + assert.equal(formatAs12HourClock("08:00"), "8:00am"); +}); test("converts exactly to midnight", () => { - assert.equal(formatAs12HourClock("00:00"), "12:00am"); -}) + assert.equal(formatAs12HourClock("00:00"), "12:00am"); +}); test("converts time just after midnight", () => { - assert.equal(formatAs12HourClock("00:30"), "12:30am"); -}) + assert.equal(formatAs12HourClock("00:30"), "12:30am"); +}); test("converts the last minute before noon", () => { - assert.equal(formatAs12HourClock("11:59"), "11:59am"); -}) + assert.equal(formatAs12HourClock("11:59"), "11:59am"); +}); test("converts exact noon to pm", () => { - assert.equal(formatAs12HourClock("12:00"), "12:00pm"); -}) + assert.equal(formatAs12HourClock("12:00"), "12:00pm"); +}); test("convert time just after noon", () => { - assert.equal(formatAs12HourClock("12:30"), "12:30pm"); -}) + assert.equal(formatAs12HourClock("12:30"), "12:30pm"); +}); test("converts the first afternoon hour", () => { - assert.equal(formatAs12HourClock("13:00"), "1:00pm"); -}) + assert.equal(formatAs12HourClock("13:00"), "1:00pm"); +}); test("converts late evening hour", () => { - assert.equal(formatAs12HourClock("23:00"), "11:00pm"); -}) + assert.equal(formatAs12HourClock("23:00"), "11:00pm"); +}); test("converts last minute of the day", () => { - assert.equal(formatAs12HourClock("23:59"), "11:59pm"); -}) + assert.equal(formatAs12HourClock("23:59"), "11:59pm"); +}); test("preserves minutes with leading zero", () => { - assert.equal(formatAs12HourClock("09:05"), "9:05am"); -}) + assert.equal(formatAs12HourClock("09:05"), "9:05am"); +}); test("preserves non-zero minutes", () => { - assert.equal(formatAs12HourClock("14:45"), "2:45pm"); -}) \ No newline at end of file + assert.equal(formatAs12HourClock("14:45"), "2:45pm"); +}); diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index f5092d9b1..273197c9d 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -10,7 +10,11 @@ test("Valid single-digit card", () => { }); test("Arbitrary non-card string", () => { - assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error"); + assert.throws( + () => getCardValue("invalid"), + /Expected a number followed by a suit, but got "invalid"/, + "Expected clear error" + ); }); // TODO: What other invalid card cases can you think of? diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index a6de5a82a..b5619e5e0 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -15,4 +15,3 @@ test(`Should return 11 when given an ace card`, () => { // To learn how to test whether a function throws an error as expected in Jest, // please refer to the Jest documentation: // https://jestjs.io/docs/expect#tothrowerror - diff --git a/package.json b/package.json index 6ae16268c..96cf0230d 100644 --- a/package.json +++ b/package.json @@ -12,5 +12,8 @@ "license": "ISC", "dependencies": { "jest": "^29.7.0" + }, + "devDependencies": { + "prettier": "^3.9.9" } -} \ No newline at end of file +} diff --git a/practice-tdd/count.js b/practice-tdd/count.js index 5518c5712..1a099f60f 100644 --- a/practice-tdd/count.js +++ b/practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { - return 5 + return 5; } diff --git a/sprint-3-stretch-exercises/password-validator.test.js b/sprint-3-stretch-exercises/password-validator.test.js index 2a58a0fb6..52f4b75e5 100644 --- a/sprint-3-stretch-exercises/password-validator.test.js +++ b/sprint-3-stretch-exercises/password-validator.test.js @@ -16,11 +16,10 @@ You must breakdown this problem in order to solve it. Find one test case first a */ import { isValidPassword } from "./password-validator.js"; test("password has at least 5 characters", () => { - // Arrange - const password = "12345"; - // Act - const result = isValidPassword(password); - // Assert - expect(result).toEqual(true); -} -); \ No newline at end of file + // Arrange + const password = "12345"; + // Act + const result = isValidPassword(password); + // Assert + expect(result).toEqual(true); +}); From fa688b11bc5fa9f281234745ef39327ea4522a6c Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 5 Oct 2026 01:24:56 +0100 Subject: [PATCH 24/27] Simplify period determination and improve formatting --- format-clock-edge-cases/timeConverter.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 389d4fad8..13f488faf 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -1,18 +1,13 @@ -function formatAs12HourClock(time){ +function formatAs12HourClock(time) { const [hourPart, minutePart] = time.split(":"); const hours = Number(hourPart); - let period; - if(hours < 12){ - period = "am"; - }else{ - period = "pm"; - } + const period = hours < 12 ? "am" : "pm"; let displayHour = hours % 12; - if(displayHour === 0){ + if (displayHour === 0) { displayHour = 12; - } + } return `${displayHour}:${minutePart}${period}`; } -export {formatAs12HourClock}; +export { formatAs12HourClock }; From 5d58269403e74f6454241f735a2cc8cb218107df Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 5 Oct 2026 01:29:25 +0100 Subject: [PATCH 25/27] Refactor display hour calculation for 12-hour clock format --- format-clock-edge-cases/timeConverter.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/format-clock-edge-cases/timeConverter.js b/format-clock-edge-cases/timeConverter.js index 13f488faf..f4a24c094 100644 --- a/format-clock-edge-cases/timeConverter.js +++ b/format-clock-edge-cases/timeConverter.js @@ -4,10 +4,7 @@ function formatAs12HourClock(time) { const period = hours < 12 ? "am" : "pm"; - let displayHour = hours % 12; - if (displayHour === 0) { - displayHour = 12; - } + const displayHour = hours % 12 || 12; return `${displayHour}:${minutePart}${period}`; } export { formatAs12HourClock }; From f9fac2a6e43f79e5c6af324f4f1913e19a3e107f Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 5 Oct 2026 02:03:20 +0100 Subject: [PATCH 26/27] Remove jsconfig.json and clean up package.json by deleting devDependencies --- .prettierrc | 1 + jsconfig.json | 18 ------------------ package.json | 5 +---- 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 jsconfig.json diff --git a/.prettierrc b/.prettierrc index 2e7e49095..59bb3b44f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,6 +4,7 @@ "embeddedLanguageFormatting": "auto", "htmlWhitespaceSensitivity": "css", "insertPragma": false, + "jsxBracketSameLine": false, "jsxSingleQuote": false, "printWidth": 80, "proseWrap": "preserve", diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index ce3653908..000000000 --- a/jsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "module": "ESNext", - "moduleResolution": "Bundler", - "target": "ES2024", - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "checkJs": undefined, - "experimentalDecorators": false, - "strictNullChecks": true, - "strictFunctionTypes": true, - "strict": true - }, - "exclude": [ - "node_modules", - "**/node_modules/*" - ] -} \ No newline at end of file diff --git a/package.json b/package.json index 96cf0230d..6ae16268c 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,5 @@ "license": "ISC", "dependencies": { "jest": "^29.7.0" - }, - "devDependencies": { - "prettier": "^3.9.9" } -} +} \ No newline at end of file From aba07711c3bd9b30a047b9cace71a3b0073e6b40 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 5 Oct 2026 02:16:02 +0100 Subject: [PATCH 27/27] Refactor folders to match main --- .../3-get-card-value.test.js | 6 +----- .../3-get-card-value.test.js | 1 + practice-tdd/count.js | 2 +- .../password-validator.test.js | 15 ++++++++------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js index 273197c9d..f5092d9b1 100644 --- a/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js @@ -10,11 +10,7 @@ test("Valid single-digit card", () => { }); test("Arbitrary non-card string", () => { - assert.throws( - () => getCardValue("invalid"), - /Expected a number followed by a suit, but got "invalid"/, - "Expected clear error" - ); + assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error"); }); // TODO: What other invalid card cases can you think of? diff --git a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index b5619e5e0..a6de5a82a 100644 --- a/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -15,3 +15,4 @@ test(`Should return 11 when given an ace card`, () => { // To learn how to test whether a function throws an error as expected in Jest, // please refer to the Jest documentation: // https://jestjs.io/docs/expect#tothrowerror + diff --git a/practice-tdd/count.js b/practice-tdd/count.js index 1a099f60f..5518c5712 100644 --- a/practice-tdd/count.js +++ b/practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { - return 5; + return 5 } diff --git a/sprint-3-stretch-exercises/password-validator.test.js b/sprint-3-stretch-exercises/password-validator.test.js index 52f4b75e5..2a58a0fb6 100644 --- a/sprint-3-stretch-exercises/password-validator.test.js +++ b/sprint-3-stretch-exercises/password-validator.test.js @@ -16,10 +16,11 @@ You must breakdown this problem in order to solve it. Find one test case first a */ import { isValidPassword } from "./password-validator.js"; test("password has at least 5 characters", () => { - // Arrange - const password = "12345"; - // Act - const result = isValidPassword(password); - // Assert - expect(result).toEqual(true); -}); + // Arrange + const password = "12345"; + // Act + const result = isValidPassword(password); + // Assert + expect(result).toEqual(true); +} +); \ No newline at end of file