summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js11
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js11
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.from.js11
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js11
4 files changed, 40 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js
index 5230c153a7..9cc4432aa7 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js
@@ -96,7 +96,7 @@ describe("correct behavior", () => {
});
test("PlainDateTime string argument", () => {
- const plainDateTime = Temporal.PlainDateTime.from("2021-07-06T23:42:01Z");
+ const plainDateTime = Temporal.PlainDateTime.from("2021-07-06T23:42:01");
expect(plainDateTime.year).toBe(2021);
expect(plainDateTime.month).toBe(7);
expect(plainDateTime.day).toBe(6);
@@ -177,4 +177,13 @@ describe("errors", () => {
Temporal.PlainDateTime.from(zonedDateTime);
}).toThrowWithMessage(TypeError, "null is not a function");
});
+
+ test("string must not contain a UTC designator", () => {
+ expect(() => {
+ Temporal.PlainDateTime.from("2021-07-06T23:42:01Z");
+ }).toThrowWithMessage(
+ RangeError,
+ "Invalid date time string '2021-07-06T23:42:01Z': must not contain a UTC designator"
+ );
+ });
});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js
index 99f6ce55fb..78388845c3 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js
@@ -42,7 +42,7 @@ describe("correct behavior", () => {
});
test("from date time string", () => {
- const plainMonthDay = Temporal.PlainMonthDay.from("2021-07-06T23:42:01Z");
+ const plainMonthDay = Temporal.PlainMonthDay.from("2021-07-06T23:42:01");
expect(plainMonthDay.monthCode).toBe("M07");
expect(plainMonthDay.day).toBe(6);
});
@@ -66,4 +66,13 @@ describe("errors", () => {
Temporal.PlainMonthDay.from("foo");
}).toThrowWithMessage(RangeError, "Invalid month day string 'foo'");
});
+
+ test("string must not contain a UTC designator", () => {
+ expect(() => {
+ Temporal.PlainMonthDay.from("2021-07-06T23:42:01Z");
+ }).toThrowWithMessage(
+ RangeError,
+ "Invalid month day string '2021-07-06T23:42:01Z': must not contain a UTC designator"
+ );
+ });
});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.from.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.from.js
index 7f3069c393..d549c5272b 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.from.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.from.js
@@ -38,7 +38,7 @@ describe("correct behavior", () => {
});
test("PlainTime string argument", () => {
- const createdPlainTime = Temporal.PlainTime.from("2021-08-27T18:44:11Z");
+ const createdPlainTime = Temporal.PlainTime.from("2021-08-27T18:44:11");
expect(createdPlainTime.hour).toBe(18);
expect(createdPlainTime.minute).toBe(44);
expect(createdPlainTime.second).toBe(11);
@@ -55,4 +55,13 @@ describe("errors", () => {
Temporal.PlainTime.from(zonedDateTime);
}).toThrowWithMessage(TypeError, "null is not a function");
});
+
+ test("string must not contain a UTC designator", () => {
+ expect(() => {
+ Temporal.PlainTime.from("2021-07-06T23:42:01Z");
+ }).toThrowWithMessage(
+ RangeError,
+ "Invalid time string '2021-07-06T23:42:01Z': must not contain a UTC designator"
+ );
+ });
});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js
index 0ba572a08b..78a1fbc031 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js
@@ -63,7 +63,7 @@ describe("correct behavior", () => {
});
test("from date time string", () => {
- const plainYearMonth = Temporal.PlainYearMonth.from("2021-07-06T23:42:01Z");
+ const plainYearMonth = Temporal.PlainYearMonth.from("2021-07-06T23:42:01");
expect(plainYearMonth.year).toBe(2021);
expect(plainYearMonth.month).toBe(7);
expect(plainYearMonth.monthCode).toBe("M07");
@@ -92,4 +92,13 @@ describe("errors", () => {
Temporal.PlainYearMonth.from("foo");
}).toThrowWithMessage(RangeError, "Invalid year month string 'foo'");
});
+
+ test("string must not contain a UTC designator", () => {
+ expect(() => {
+ Temporal.PlainYearMonth.from("2021-07-06T23:42:01Z");
+ }).toThrowWithMessage(
+ RangeError,
+ "Invalid year month string '2021-07-06T23:42:01Z': must not contain a UTC designator"
+ );
+ });
});