1- import { formatAs12HourClock } from "./timeConverter.js" ;
1+ import { formatAs12HourClock } from "./timeConverter.js" ;
22import assert from "node:assert" ;
33import 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 time after 12:00" , 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} ) ;
12+
13+ test ( "correctly convert time after 12:00" , function ( ) {
14+ assert . equal ( formatAs12HourClock ( "23:00" ) , "11:00 pm" ) ;
15+ } ) ;
16+
17+ test ( "can correctly convert morning time" , function ( ) {
18+ assert . equal ( formatAs12HourClock ( "08:00" ) , "08:00 am" ) ;
19+ } ) ;
20+
21+ test ( "can correctly convert midnight" , function ( ) {
22+ assert . equal ( formatAs12HourClock ( "00:00" ) , "12:00 am" ) ;
23+ } ) ;
24+
25+ test ( "can correctly convert midday" , function ( ) {
26+ assert . equal ( formatAs12HourClock ( "12:00" ) , "12:00 pm" ) ;
27+ } ) ;
28+
29+ test ( "can correctly convert 12:30 pm" , function ( ) {
30+ assert . equal ( formatAs12HourClock ( "12:30" ) , "12:30 pm" ) ;
31+ } ) ;
32+
33+ test ( "preserves minutes in the morning" , function ( ) {
34+ assert . equal ( formatAs12HourClock ( "09:45" ) , "09:45 am" ) ;
35+ } ) ;
36+
37+ test ( "preserves minutes in the afternoon" , function ( ) {
38+ assert . equal ( formatAs12HourClock ( "13:45" ) , "1:45 pm" ) ;
39+ } ) ;
40+
41+ test ( "correctly converts 1:00 pm" , function ( ) {
42+ assert . equal ( formatAs12HourClock ( "13:00" ) , "1:00 pm" ) ;
43+ } ) ;
44+
45+ test ( "correctly converts 6:30 pm" , function ( ) {
46+ assert . equal ( formatAs12HourClock ( "18:30" ) , "6:30 pm" ) ;
47+ } ) ;
48+
49+ test ( "correctly converts 11:59 pm" , function ( ) {
50+ assert . equal ( formatAs12HourClock ( "23:59" ) , "11:59 pm" ) ;
51+ } ) ;
52+
53+ test ( "correctly converts 11:59 am" , function ( ) {
54+ assert . equal ( formatAs12HourClock ( "11:59" ) , "11:59 am" ) ;
55+ } ) ;
0 commit comments