mirror of https://github.com/tc39/test262.git
Temporal: Use propertyBagObserver in monthDayFromFields test
This commit is contained in:
parent
f4377a7cf0
commit
892a5dccd2
|
@ -24,20 +24,13 @@ const missingDay = {
|
|||
assert.throws(TypeError, () => instance.monthDayFromFields(missingDay), "day should be checked before year and month");
|
||||
|
||||
let got = [];
|
||||
const fieldsSpy = {
|
||||
get year() {
|
||||
got.push("year");
|
||||
},
|
||||
get month() {
|
||||
got.push("month");
|
||||
},
|
||||
get monthCode() {
|
||||
got.push("monthCode");
|
||||
},
|
||||
get day() {
|
||||
got.push("day");
|
||||
return 1;
|
||||
},
|
||||
};
|
||||
const fieldsSpy = TemporalHelpers.propertyBagObserver(got, { day: 1 });
|
||||
assert.throws(TypeError, () => instance.monthDayFromFields(fieldsSpy), "incomplete fields should be rejected (but after reading all non-required fields)");
|
||||
assert.compareArray(got, ["day", "month", "monthCode", "year"], "fields should be read in alphabetical order");
|
||||
assert.compareArray(got, [
|
||||
"get day",
|
||||
"get day.valueOf",
|
||||
"call day.valueOf",
|
||||
"get month",
|
||||
"get monthCode",
|
||||
"get year",
|
||||
], "fields should be read in alphabetical order");
|
||||
|
|
Loading…
Reference in New Issue