test262/test/built-ins/Temporal/PlainTime/compare/plaintime-propertybag-no-time-units.js
Philip Chimento 7b3c176629 Add missing tests for PlainTime property bag with no time units
We already had similar tests to these for other methods, such as
Temporal.PlainTime.prototype.equals(). since() and until() should have
these tests too.

Update assertion messages in all of the existing tests as well, as per
Ms2ger's review comment.
2022-04-21 12:14:10 -07:00

16 lines
583 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 no properties are 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");