Skip to content

Commit 255f29d

Browse files
cover all 6 hour cases and both single-digit and double-digit minute cases
1 parent d5ea319 commit 255f29d

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

‎format-clock-edge-cases/timeConverter.test.js‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@ import { formatAs12HourClock } from "./timeConverter.js";
22
import assert from "node:assert";
33
import test from "node:test";
44

5+
test("can correctly convert midnight with double-digit minutes", function () {
6+
assert.equal(formatAs12HourClock("00:15"), "12:15 am");
7+
});
8+
9+
test("can correctly convert noon with double-digit minutes", function () {
10+
assert.equal(formatAs12HourClock("12:15"), "12:15 pm");
11+
});
12+
13+
test("can correctly convert morning single-digit hours with double-digit minutes", function () {
14+
assert.equal(formatAs12HourClock("08:15"), "08:15 am");
15+
});
16+
17+
test("can correctly convert late morning with single-digit minutes", function () {
18+
assert.equal(formatAs12HourClock("11:05"), "11:05 am");
19+
});
20+
21+
test("can correctly convert afternoon with double-digit minutes", function () {
22+
assert.equal(formatAs12HourClock("13:15"), "01:15 pm");
23+
});
24+
25+
test("can correctly convert late evening with single-digit minutes", function () {
26+
assert.equal(formatAs12HourClock("23:05"), "11:05 pm");
27+
});
28+
529
test("correctly convert time after 12:00", function () {
630
assert.equal(formatAs12HourClock("23:00"), "11:00 pm");
731
});
@@ -21,7 +45,7 @@ test("can correctly convert minutes", function () {
2145
test("can correctly convert noon", function () {
2246
assert.equal(formatAs12HourClock("12:00"), "12:00 pm");
2347
});
24-
test("can correctly convert noon", function () {
48+
test("can correctly convert one minute before noon", function () {
2549
assert.equal(formatAs12HourClock("11:59"), "11:59 am");
2650
});
2751
test("can correctly convert one hour after noon", function () {

0 commit comments

Comments
 (0)