|
1 | | -import {formatAs12HourClock} from "./timeConverter.js"; |
| 1 | +import { formatAs12HourClock } from "./timeConverter.js"; |
2 | 2 | import assert from "node:assert"; |
3 | 3 | import test from "node:test"; |
4 | 4 |
|
5 | | -test("correctly convert time after 12:00", function(){ |
6 | | - assert.equal(formatAs12HourClock("23:00"), "11:00 pm"); |
7 | | -}); |
| 5 | +test("correctly convert time after 12:00", () => |
| 6 | + assert.equal(formatAs12HourClock("23:00"), "11:00 pm")); |
8 | 7 |
|
9 | | -test("can correctly convert morning time", function() { |
10 | | - assert.equal(formatAs12HourClock("08:00"), "08:00 am"); |
11 | | -}); |
| 8 | +test("can correctly convert morning time", () => |
| 9 | + assert.equal(formatAs12HourClock("08:00"), "8:00 am")); |
| 10 | + |
| 11 | +test("can correctly convert midnight", () => |
| 12 | + assert.equal(formatAs12HourClock("00:00"), "12:00 am")); |
| 13 | + |
| 14 | +test("noon is pm", () => |
| 15 | + assert.equal(formatAs12HourClock("12:00"), "12:00 pm")); |
| 16 | + |
| 17 | +test("noon with minutes", () => |
| 18 | + assert.equal(formatAs12HourClock("12:45"), "12:45 pm")); |
| 19 | + |
| 20 | +test("afternoon keeps minutes", () => |
| 21 | + assert.equal(formatAs12HourClock("13:30"), "1:30 pm")); |
| 22 | + |
| 23 | +test("evening keeps minutes", () => |
| 24 | + assert.equal(formatAs12HourClock("23:15"), "11:15 pm")); |
| 25 | + |
| 26 | +test("midnight with minutes", () => |
| 27 | + assert.equal(formatAs12HourClock("00:30"), "12:30 am")); |
| 28 | + |
| 29 | +test("just before noon", () => |
| 30 | + assert.equal(formatAs12HourClock("11:59"), "11:59 am")); |
0 commit comments