mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +00:00
LibJS: Implement Temporal.Instant.prototype.epochNanoseconds
This commit is contained in:
parent
b5d0cdc97e
commit
117323f2d9
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