1- import { formatAs12HourClock } from "./timeConverter.js" ;
1+
2+ import { formatAs12HourClock } from "./timeConverter.js" ;
23import assert from "node:assert" ;
34import test from "node:test" ;
45
5- test ( "correctly convert time after 12:00" , function ( ) {
6- assert . equal ( formatAs12HourClock ( "23:00" ) , "11:00 pm" ) ;
6+ test ( "correctly convert time after 12:00" , function ( ) {
7+ assert . equal ( formatAs12HourClock ( "23:00" ) , "11:00 pm" ) ;
8+ } ) ;
9+
10+ test ( "can correctly convert morning time" , function ( ) {
11+ assert . equal ( formatAs12HourClock ( "08:00" ) , "08:00 am" ) ;
12+ } ) ;
13+
14+ test ( "correctly convert 13:00 with a leading zero" , function ( ) {
15+ assert . equal ( formatAs12HourClock ( "13:00" ) , "01:00 pm" ) ;
16+ } ) ;
17+
18+ test ( "correctly keep the minutes" , function ( ) {
19+ assert . equal ( formatAs12HourClock ( "13:45" ) , "01:45 pm" ) ;
20+ } ) ;
21+
22+ test ( "correctly convert midnight" , function ( ) {
23+ assert . equal ( formatAs12HourClock ( "00:00" ) , "12:00 am" ) ;
724} ) ;
825
9- test ( "can correctly convert morning time " , function ( ) {
10- assert . equal ( formatAs12HourClock ( "08 :00" ) , "08 :00 am " ) ;
26+ test ( "correctly convert noon " , function ( ) {
27+ assert . equal ( formatAs12HourClock ( "12 :00" ) , "12 :00 pm " ) ;
1128} ) ;
1229
1330test ( "correctly convert midnight" , function ( ) {
@@ -17,10 +34,10 @@ test("correctly convert noon", function() {
1734 assert . equal ( formatAs12HourClock ( "12:00" ) , "12:00 pm" ) ;
1835} ) ;
1936test ( "correctly convert 13:00" , function ( ) {
20- assert . equal ( formatAs12HourClock ( "13:00" ) , "1 :00 pm" ) ;
37+ assert . equal ( formatAs12HourClock ( "13:00" ) , "01 :00 pm" ) ;
2138} ) ;
2239test ( "correctly keep the minutes" , function ( ) {
23- assert . equal ( formatAs12HourClock ( "13:45" ) , "1 :45 pm" ) ;
40+ assert . equal ( formatAs12HourClock ( "13:45" ) , "01 :45 pm" ) ;
2441} ) ;
2542test ( "correctly convert 12:30" , function ( ) {
2643 assert . equal ( formatAs12HourClock ( "12:30" ) , "12:30 pm" ) ;
0 commit comments