1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:07:34 +00:00

LibJS: Add Temporal.Instant.prototype.equals()

This commit is contained in:
Idan Horowitz 2021-07-11 21:23:38 +03:00 committed by Linus Groh
parent 84403ab423
commit 2382f67e0b
4 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,16 @@
describe("correct behavior", () => {
test("basic functionality", () => {
const instant1 = new Temporal.Instant(111n);
expect(instant1.equals(instant1));
const instant2 = new Temporal.Instant(999n);
expect(!instant1.equals(instant2));
});
});
test("errors", () => {
test("this value must be a Temporal.Instant object", () => {
expect(() => {
Temporal.Instant.prototype.equals.call("foo", 1, 2);
}).toThrowWithMessage(TypeError, "Not a Temporal.Instant");
});
});