summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dateFromFields/fields-not-object.js
blob: 38475bb330d13273ab57bcec5892aae3760f69dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// |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-temporal.calendar.prototype.datefromfields
description: Throw a TypeError if the fields is not an object
info: |
  4. If Type(_fields_) is not Object, throw a *TypeError* exception.
features: [BigInt, Symbol, Temporal, arrow-function]
---*/

const tests = [undefined, null, true, false, "string", Symbol("sym"), Infinity, NaN, Math.PI, 42n];
const iso = Temporal.Calendar.from("iso8601");
for (const fields of tests) {
  assert.throws(
    TypeError,
    () => iso.dateFromFields(fields, {})
    `dateFromFields(${typeof fields}) throws a TypeError exception`
  );
}

reportCompare(0, 0);