|
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"); |
| 5 | +test("correctly convert time after 12:00", function () { |
| 6 | + assert.equal(formatAs12HourClock("23:00"), "11:00 pm"); |
7 | 7 | }); |
8 | 8 |
|
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"); |
| 11 | +}); |
| 12 | + |
| 13 | +test("converts midnight correctly", function () { |
| 14 | + assert.equal(formatAs12HourClock("00:00"), "12:00 am"); |
| 15 | +}); |
| 16 | + |
| 17 | +test("converts one minute after midnight", function () { |
| 18 | + assert.equal(formatAs12HourClock("00:01"), "12:01 am"); |
| 19 | +}); |
| 20 | + |
| 21 | +test("converts early morning time", function () { |
| 22 | + assert.equal(formatAs12HourClock("01:30"), "01:30 am"); |
| 23 | +}); |
| 24 | + |
| 25 | +test("converts last minute before noon", function () { |
| 26 | + assert.equal(formatAs12HourClock("11:59"), "11:59 am"); |
| 27 | +}); |
| 28 | + |
| 29 | +test("converts noon correctly", function () { |
| 30 | + assert.equal(formatAs12HourClock("12:00"), "12:00 pm"); |
| 31 | +}); |
| 32 | + |
| 33 | +test("converts one minute after noon", function () { |
| 34 | + assert.equal(formatAs12HourClock("12:01"), "12:01 pm"); |
| 35 | +}); |
| 36 | + |
| 37 | +test("converts afternoon time", function () { |
| 38 | + assert.equal(formatAs12HourClock("13:30"), "01:30 pm"); |
| 39 | +}); |
| 40 | + |
| 41 | +test("converts evening time", function () { |
| 42 | + assert.equal(formatAs12HourClock("18:45"), "06:45 pm"); |
| 43 | +}); |
| 44 | + |
| 45 | +test("converts last minute of the day", function () { |
| 46 | + assert.equal(formatAs12HourClock("23:59"), "11:59 pm"); |
| 47 | +}); |
| 48 | + |
| 49 | +test("converts 09:59 correctly", function () { |
| 50 | + assert.equal(formatAs12HourClock("09:59"), "09:59 am"); |
| 51 | +}); |
| 52 | + |
| 53 | +test("converts 10:00 correctly", function () { |
| 54 | + assert.equal(formatAs12HourClock("10:00"), "10:00 am"); |
| 55 | +}); |
| 56 | + |
| 57 | +test("converts 12:59 correctly", function () { |
| 58 | + assert.equal(formatAs12HourClock("12:59"), "12:59 pm"); |
| 59 | +}); |
| 60 | + |
| 61 | +test("converts 13:00 correctly", function () { |
| 62 | + assert.equal(formatAs12HourClock("13:00"), "01:00 pm"); |
| 63 | +}); |
| 64 | + |
| 65 | +test("converts 23:00 correctly", function () { |
| 66 | + assert.equal(formatAs12HourClock("23:00"), "11:00 pm"); |
11 | 67 | }); |
0 commit comments