mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Implement Temporal.Duration.prototype.toJSON()
This commit is contained in:
parent
b2548393d2
commit
90fa356b93
Notes:
sideshowbarker
2024-07-18 01:26:33 +09:00
Author: https://github.com/linusg
Commit: 90fa356b93
Pull-request: https://github.com/SerenityOS/serenity/pull/10834
Reviewed-by: https://github.com/IdanHo ✅
3 changed files with 32 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
|||
describe("correct behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Temporal.Duration.prototype.toJSON).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
expect(new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).toJSON()).toBe(
|
||||
"P1Y2M3W4DT5H6M7.00800901S"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.Duration object", () => {
|
||||
expect(() => {
|
||||
Temporal.Duration.prototype.toJSON.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.Duration");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue