mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-11 20:16:02 +00:00
LibJS: Implement Temporal.Instant.prototype.epochNanoseconds
This commit is contained in:
parent
b5d0cdc97e
commit
117323f2d9
Notes:
sideshowbarker
2024-07-18 10:02:31 +09:00
Author: https://github.com/linusg
Commit: 117323f2d9
Pull-request: https://github.com/SerenityOS/serenity/pull/8568
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/bgianfo ✅
4 changed files with 44 additions and 0 deletions
|
@ -0,0 +1,25 @@
|
|||
describe("correct behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
expect(new Temporal.Instant(0n).epochNanoseconds).toBe(0n);
|
||||
expect(new Temporal.Instant(1n).epochNanoseconds).toBe(1n);
|
||||
expect(new Temporal.Instant(999n).epochNanoseconds).toBe(999n);
|
||||
expect(new Temporal.Instant(8_640_000_000_000_000_000_000n).epochNanoseconds).toBe(
|
||||
8_640_000_000_000_000_000_000n
|
||||
);
|
||||
|
||||
expect(new Temporal.Instant(-0n).epochNanoseconds).toBe(-0n);
|
||||
expect(new Temporal.Instant(-1n).epochNanoseconds).toBe(-1n);
|
||||
expect(new Temporal.Instant(-999n).epochNanoseconds).toBe(-999n);
|
||||
expect(new Temporal.Instant(-8_640_000_000_000_000_000_000n).epochNanoseconds).toBe(
|
||||
-8_640_000_000_000_000_000_000n
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("errors", () => {
|
||||
test("this value must be a Temporal.Instant object", () => {
|
||||
expect(() => {
|
||||
Reflect.get(Temporal.Instant.prototype, "epochNanoseconds", "foo");
|
||||
}).toThrowWithMessage(TypeError, "Not a Temporal.Instant");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue