Skip to content

Commit 23d7cfd

Browse files
committed
modified the test.js
1 parent cf5075f commit 23d7cfd

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

‎format-clock-edge-cases/timeConverter.test.js‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,31 @@ import {formatAs12HourClock} from "./timeConverter.js";
22
import assert from "node:assert";
33
import 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

Comments
 (0)