mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:27:35 +00:00
LibJS/Tests: Add tests for Date.prototype.toTemporalInstant()
This commit is contained in:
parent
e5a1e535cc
commit
9f2dd89446
1 changed files with 15 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
|||
describe("correct behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
const date = new Date("2021-07-09T01:36:00Z");
|
||||
const instant = date.toTemporalInstant();
|
||||
expect(instant.epochSeconds).toBe(1625794560);
|
||||
});
|
||||
});
|
||||
|
||||
test("errors", () => {
|
||||
test("this value must be a Date object", () => {
|
||||
expect(() => {
|
||||
Date.prototype.toTemporalInstant.call(123);
|
||||
}).toThrowWithMessage(TypeError, "Not a Date object");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue