From 892a5dccd2a59a63f3a363db07f53bf896912699 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 19 Sep 2023 11:13:44 -0700 Subject: [PATCH] Temporal: Use propertyBagObserver in monthDayFromFields test --- .../monthDayFromFields/missing-properties.js | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/missing-properties.js b/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/missing-properties.js index 05b3b73f4c4..0c426af6869 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/missing-properties.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/missing-properties.js @@ -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");