test262/test/built-ins/Temporal/PlainTime/compare/plaintime-propertybag-no-time-units.js
Philip Chimento 4158545044 Temporal.PlainTime property bags
Tests for the normative change to Temporal made in
https://github.com/tc39/proposal-temporal/pull/1862
2021-11-01 14:07:02 -04:00

16 lines
594 B
JavaScript

// 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.plaintime.compare
description: Missing time units in property bag default to 0
features: [Temporal]
---*/
const props = {};
assert.throws(TypeError, () => Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30)), "TypeError if at least one property is not present");
props.minute = 30;
const result = Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30));
assert.sameValue(result, 0, "missing time units default to 0");