mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:47:34 +00:00
LibJS: Implement Temporal.ZonedDateTime.prototype.equals
This commit is contained in:
parent
ac12581140
commit
706296374b
5 changed files with 70 additions and 0 deletions
|
@ -0,0 +1,23 @@
|
|||
describe("correct behavior", () => {
|
||||
test("length is 1", () => {
|
||||
expect(Temporal.ZonedDateTime.prototype.equals).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
const zonedDateTimeOne = new Temporal.ZonedDateTime(1n, new Temporal.TimeZone("UTC"));
|
||||
const zonedDateTimeTwo = new Temporal.ZonedDateTime(2n, new Temporal.TimeZone("UTC"));
|
||||
|
||||
expect(zonedDateTimeOne.equals(zonedDateTimeOne)).toBeTrue();
|
||||
expect(zonedDateTimeTwo.equals(zonedDateTimeTwo)).toBeTrue();
|
||||
expect(zonedDateTimeOne.equals(zonedDateTimeTwo)).toBeFalse();
|
||||
expect(zonedDateTimeTwo.equals(zonedDateTimeOne)).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.ZonedDateTime object", () => {
|
||||
expect(() => {
|
||||
Temporal.ZonedDateTime.prototype.equals.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue