|
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 | 11 | }); |
| 12 | + |
| 13 | +//if input is equal to "00:00" |
| 14 | +test(`can correctly convert input of "00:00"`, () => |
| 15 | + assert.equal(formatAs12HourClock("00:00"), "12:00 am")); |
| 16 | +//if input is equal to "12:00" |
| 17 | +test(`can correctly convert input of "12:00"`, () => |
| 18 | + assert.equal(formatAs12HourClock("12:00"), "12:00 pm")); |
| 19 | +//if input is equal to " 07:23" |
| 20 | +test(`can correctly convert minutes`, () => |
| 21 | + assert.equal(formatAs12HourClock("17:23"), "05:23 pm")); |
| 22 | +// test with leading zeros |
| 23 | +test("can correctly display with leading zeros", () => |
| 24 | + assert.equal(formatAs12HourClock("03:07"), "03:07 am")); |
0 commit comments