@@ -2,10 +2,31 @@ 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 ( "can return 'invalid input.' " , function ( ) {
6+ assert . equal ( formatAs12HourClock ( "25 :00" ) , "invalid input. " ) ;
77} ) ;
88
9- test ( "can correctly convert morning time" , function ( ) {
10- assert . equal ( formatAs12HourClock ( "08:00" ) , "08:00 am" ) ;
9+ test ( "can return 'invalid input.'" , function ( ) {
10+ assert . equal ( formatAs12HourClock ( "-01:00" ) , "invalid input." ) ;
11+ } )
12+
13+ test ( "can correctly convert morning time 24:12" , function ( ) {
14+ assert . equal ( formatAs12HourClock ( "24:12" ) , "12:12am" ) ;
15+ } ) ;
16+
17+ test ( "can correctly convert morning time 00:12" , function ( ) {
18+ assert . equal ( formatAs12HourClock ( "00:12" ) , "12:12am" ) ;
19+ } ) ;
20+
21+ test ( "can correctly convert afternoon time 12:12" , function ( ) {
22+ assert . equal ( formatAs12HourClock ( "12:12" ) , "12:12pm" ) ;
1123} ) ;
24+
25+ test ( "can correctly convert afternoon time 15:30" , function ( ) {
26+ assert . equal ( formatAs12HourClock ( "15:30" ) , "3:30pm" ) ;
27+ } ) ;
28+
29+ test ( "can correctly convert morning time 03:45" , function ( ) {
30+ assert . equal ( formatAs12HourClock ( "03:45" ) , "3:45am" ) ;
31+ } ) ;
32+
0 commit comments