|
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("can correctly convert midnight", function () { |
| 14 | + assert.equal(formatAs12HourClock("00:00"), "12:00 am"); |
| 15 | +}); |
| 16 | + |
| 17 | +test("correctly convert time 1 hour before 12:00", function () { |
| 18 | + assert.equal(formatAs12HourClock("11:00"), "11:00 am"); |
| 19 | +}); |
| 20 | + |
| 21 | +test("correctly convert time 2 hours before 12:00", function () { |
| 22 | + assert.equal(formatAs12HourClock("10:00"), "10:00 am"); |
| 23 | +}); |
| 24 | + |
| 25 | +test("correctly convert time 3 hours before 12:00", function () { |
| 26 | + assert.equal(formatAs12HourClock("09:00"), "09:00 am"); |
| 27 | +}); |
| 28 | + |
| 29 | +test("can correctly convert every half hour before 12:00", function () { |
| 30 | + assert.equal(formatAs12HourClock("09:30"), "09:30 am"); |
| 31 | +}); |
| 32 | + |
| 33 | +test("can correctly convert hours in the afternoon", function () { |
| 34 | + assert.equal(formatAs12HourClock("13:00"), "1:00 pm"); |
| 35 | +}); |
| 36 | + |
| 37 | +test("correctly convert half hour after 12:00", function () { |
| 38 | + assert.equal(formatAs12HourClock("13:30"), "1:30 pm"); |
| 39 | +}); |
| 40 | + |
| 41 | +test("correctly convert half hour after 12:00", function () { |
| 42 | + assert.equal(formatAs12HourClock("23:30"), "11:30 pm"); |
11 | 43 | }); |
0 commit comments