Backed out changeset 8c746156d7c5 (bug 1908317) as requested by developer CLOSED...
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / ZonedDateTime / prototype / equals / argument-propertybag-invalid-offset-string.js
blob6fdf96900397da6f65c7bc60f160df30e30c7af3
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.
5 /*---
6 esid: sec-temporal.zoneddatetime.prototype.equals
7 description: Property bag with offset property is rejected if offset is in the wrong format
8 features: [Temporal]
9 ---*/
11 const timeZone = "UTC";
12 const instance = new Temporal.ZonedDateTime(0n, timeZone);
14 const badOffsets = [
15   "00:00",    // missing sign
16   "+0",       // too short
17   "-000:00",  // too long
18   0,          // must be a string
19   null,       // must be a string
20   true,       // must be a string
21   1000n,      // must be a string
23 badOffsets.forEach((offset) => {
24   const arg = { year: 2021, month: 10, day: 28, offset, timeZone };
25   assert.throws(
26     typeof(offset) === 'string' ? RangeError : TypeError,
27     () => instance.equals(arg),
28     `"${offset} is not a valid offset string`
29   );
30 });
32 reportCompare(0, 0);