argument-object-insufficient-data.js (902B)
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. 4 5 /*--- 6 esid: sec-temporal.plaindatetime.compare 7 description: Plain object arguments may throw if they do not contain sufficient information 8 features: [Temporal] 9 ---*/ 10 11 const dt1 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789); 12 const dt2 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102); 13 14 assert.throws( 15 TypeError, 16 () => Temporal.PlainDateTime.compare({ year: 1976 }, dt2), 17 "object must contain at least the required properties (first arg)" 18 ); 19 20 assert.throws( 21 TypeError, 22 () => Temporal.PlainDateTime.compare(dt1, { year: 2019 }), 23 "object must contain at least the required properties (second arg)" 24 ); 25 26 reportCompare(0, 0);