summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/id/branding.js
blob: 447fe2b6c17d0a50dd76d8a02c027521b9aa188b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-get-temporal.calendar.prototype.id
description: Throw a TypeError if the receiver is invalid
features: [Symbol, Temporal]
---*/

const descriptor = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "id");
const id = descriptor.get;

assert.sameValue(typeof id, "function");

assert.throws(TypeError, () => id.call(undefined), "undefined");
assert.throws(TypeError, () => id.call(null), "null");
assert.throws(TypeError, () => id.call(true), "true");
assert.throws(TypeError, () => id.call(""), "empty string");
assert.throws(TypeError, () => id.call(Symbol()), "symbol");
assert.throws(TypeError, () => id.call(1), "1");
assert.throws(TypeError, () => id.call({}), "plain object");
assert.throws(TypeError, () => id.call(Temporal.Calendar), "Temporal.Calendar");
assert.throws(TypeError, () => id.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype");

reportCompare(0, 0);