Skip to content

Commit

Permalink
Temporal: Use propertyBagObserver in monthDayFromFields test
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomato authored and gibson042 committed Oct 26, 2023
1 parent f4377a7 commit 892a5dc
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

0 comments on commit 892a5dc

Please sign in to comment.