@@ -2,10 +2,54 @@ 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 ( ) {
5+ test ( "correctly convert hours after 12:00" , ( ) => {
66 assert . equal ( formatAs12HourClock ( "23:00" ) , "11:00 pm" ) ;
77} ) ;
88
9- test ( "can correctly convert morning time" , function ( ) {
9+ test ( "correctly convert minutes after 12:00" , ( ) => {
10+ assert . equal ( formatAs12HourClock ( "23:53" ) , "11:53 pm" ) ;
11+ } ) ;
12+
13+ test ( "can correctly convert morning time" , ( ) => {
1014 assert . equal ( formatAs12HourClock ( "08:00" ) , "08:00 am" ) ;
1115} ) ;
16+
17+ test ( "can correctly convert morning time minutes" , ( ) => {
18+ assert . equal ( formatAs12HourClock ( "08:30" ) , "08:30 am" ) ;
19+ } ) ;
20+
21+ test ( "can correctly convert morning time minutes" , ( ) => {
22+ assert . equal ( formatAs12HourClock ( "08:34" ) , "08:34 am" ) ;
23+ } ) ;
24+
25+ test ( "can successfully convert midnight time" , ( ) =>
26+ assert . equal ( formatAs12HourClock ( "24:00" ) , "12:00 am" ) ) ;
27+
28+
29+
30+ /*
31+ Edge cases:
32+ Correctly convert hours after 12:00
33+ Input | Expected
34+ 23:00 11:00 pm
35+
36+ Correctly convert afternoon hours and minutes
37+ Input | Expected
38+ 23:00 11:53 pm
39+
40+ Correctly convert morning time and minutes
41+ Input | Expected
42+ 08:00 08:00 am
43+
44+ Correctly convert morning time and minutes
45+ Input | Expected
46+ 08:30 08:30 am
47+
48+ Correctly convert morning time and minutes
49+ Input | Expected
50+ 08:34 08:34 am
51+
52+ Correctly convert midnight time
53+ Input | Expected
54+ 24:00 12:00 am
55+ */
0 commit comments