Skip to content

Commit f3850fc

Browse files
format timeConverter.test.js for consistency and readability
1 parent b3e50e6 commit f3850fc

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
import {formatAs12HourClock} from "./timeConverter.js";
1+
import { formatAs12HourClock } from "./timeConverter.js";
22
import assert from "node:assert";
33
import test from "node:test";
44

5-
test("correctly convert time after 12:00", function(){
6-
assert.equal(formatAs12HourClock("23:00"), "11:00 pm");
5+
test("correctly convert late evening time", function () {
6+
assert.equal(formatAs12HourClock("23:00"), "11:00 pm");
77
});
88

9-
test("can correctly convert morning time", function() {
10-
assert.equal(formatAs12HourClock("08:00"), "08:00 am");
9+
test("can correctly convert morning time", function () {
10+
assert.equal(formatAs12HourClock("08:00"), "08:00 am");
1111
});
1212

13+
test("can correctly convert noon", function () {
14+
assert.equal(formatAs12HourClock("12:00"), "12:00 pm");
15+
});
16+
17+
test("can correctly convert midnight", function () {
18+
assert.equal(formatAs12HourClock("00:00"), "12:00 am");
19+
});
1320

14-
test("can correctly convert morning time", function() {
15-
assert.equal(formatAs12HourClock("12:00"), "12:00 pm");
21+
test("preserves non-zero minutes in afternoon", function () {
22+
assert.equal(formatAs12HourClock("13:45"), "01:45 pm");
1623
});
24+
25+
test("can correctly convert post-noon minutes", function () {
26+
assert.equal(formatAs12HourClock("12:30"), "12:30 pm");
27+
});

0 commit comments

Comments
 (0)