1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 esid: sec-temporal.zoneddatetime.prototype.equals
8 Appropriate error thrown when argument cannot be converted to a valid string
9 or property bag for ZonedDateTime
10 features: [BigInt, Symbol, Temporal]
13 const timeZone = "UTC";
14 const instance = new Temporal.ZonedDateTime(0n, timeZone);
16 const primitiveTests = [
17 [undefined, "undefined"],
21 [1, "number that doesn't convert to a valid ISO string"],
22 [19761118, "number that would convert to a valid ISO string in other contexts"],
26 for (const [arg, description] of primitiveTests) {
28 typeof arg === 'string' ? RangeError : TypeError,
29 () => instance.equals(arg),
30 `${description} does not convert to a valid ISO string`
34 const typeErrorTests = [
37 [Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
38 [Temporal.ZonedDateTime.prototype, "Temporal.ZonedDateTime.prototype, object"],
41 for (const [arg, description] of typeErrorTests) {
42 assert.throws(TypeError, () => instance.equals(arg), `${description} is not a valid property bag and does not convert to a string`);