diff options
author | Linus Groh <mail@linusgroh.de> | 2021-09-08 23:02:53 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-08 23:42:26 +0100 |
commit | 6987e326d89335294bf0e0a76629c2659b6d2d9b (patch) | |
tree | a374d5b4ccde07f4cce284d64827a8a7f94894eb /Userland/Libraries/LibJS/Tests | |
parent | 9f78a957d579ff03391331aea81004cfa2c0ba33 (diff) | |
download | serenity-6987e326d89335294bf0e0a76629c2659b6d2d9b.zip |
LibJS: Implement Temporal.PlainTime.prototype.toLocaleString()
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toLocaleString.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toLocaleString.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toLocaleString.js new file mode 100644 index 0000000000..05a5ce420e --- /dev/null +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toLocaleString.js @@ -0,0 +1,18 @@ +describe("correct behavior", () => { + test("length is 0", () => { + expect(Temporal.PlainTime.prototype.toLocaleString).toHaveLength(0); + }); + + test("basic functionality", () => { + const plainTime = new Temporal.PlainTime(18, 14, 47, 123, 456, 789); + expect(plainTime.toLocaleString()).toBe("18:14:47.123456789"); + }); +}); + +describe("errors", () => { + test("this value must be a Temporal.PlainTime object", () => { + expect(() => { + Temporal.PlainTime.prototype.toLocaleString.call("foo"); + }).toThrowWithMessage(TypeError, "Not a Temporal.PlainTime"); + }); +}); |