diff --git a/test/built-ins/Temporal/Duration/compare/calendar-dateadd-called-with-options-undefined.js b/test/built-ins/Temporal/Duration/compare/calendar-dateadd-called-with-options-undefined.js index 8306f92f2bf..6ce8be530db 100644 --- a/test/built-ins/Temporal/Duration/compare/calendar-dateadd-called-with-options-undefined.js +++ b/test/built-ins/Temporal/Duration/compare/calendar-dateadd-called-with-options-undefined.js @@ -17,6 +17,5 @@ const relativeTo = new Temporal.ZonedDateTime(0n, timeZone, calendar); const duration1 = new Temporal.Duration(0, 0, 1); const duration2 = new Temporal.Duration(0, 0, 1, 1); Temporal.Duration.compare(duration1, duration2, { relativeTo }); -assert.sameValue(calendar.dateAddCallCount, 4); -// one call in CalculateOffsetShift for each duration argument, plus one in -// UnbalanceDurationRelative for each duration argument +assert.sameValue(calendar.dateAddCallCount, 2); +// one call for each duration argument to add it to relativeTo diff --git a/test/built-ins/Temporal/Duration/compare/order-of-operations.js b/test/built-ins/Temporal/Duration/compare/order-of-operations.js index a820914e5c6..e7d57e90e2c 100644 --- a/test/built-ins/Temporal/Duration/compare/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/compare/order-of-operations.js @@ -266,31 +266,19 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "call options.relativeTo.timeZone.getOffsetNanosecondsFor", ]); -const expectedOpsForCalculateOffsetShift = [ - // CalculateOffsetShift on first argument - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - // ...in AddZonedDateTime +const expectedOpsForZonedCalendarCompare = [ "get options.relativeTo.timeZone.getOffsetNanosecondsFor", "call options.relativeTo.timeZone.getOffsetNanosecondsFor", + // AddZonedDateTime on first argument "get options.relativeTo.calendar.dateAdd", "call options.relativeTo.calendar.dateAdd", "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", - // ...done with AddZonedDateTime - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - // CalculateOffsetShift on second argument - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", + // AddZonedDateTime on second argument "get options.relativeTo.calendar.dateAdd", "call options.relativeTo.calendar.dateAdd", "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", ]; const zonedRelativeTo = TemporalHelpers.propertyBagObserver(actual, { @@ -317,7 +305,7 @@ Temporal.Duration.compare( ); assert.compareArray( actual, - expectedOpsForZonedRelativeTo.concat(expectedOpsForCalculateOffsetShift), + expectedOpsForZonedRelativeTo.concat(expectedOpsForZonedCalendarCompare), "order of operations with ZonedDateTime relativeTo and no calendar units except days" ); actual.splice(0); // clear @@ -330,47 +318,20 @@ Temporal.Duration.compare( ); assert.compareArray( actual, - expectedOpsForZonedRelativeTo.concat([ - // CalculateOffsetShift on first arg - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - // AddZonedDateTime - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - // CalculateOffsetShift on second arg - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - // AddZonedDateTime - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - ]), + expectedOpsForZonedRelativeTo, "order of operations with ZonedDateTime relativeTo and only time units" ); actual.splice(0); // clear -// code path through UnbalanceDurationRelative that balances higher units down -// to days: -const expectedOpsForDayBalancing = expectedOpsForZonedRelativeTo.concat( - expectedOpsForCalculateOffsetShift, - [ - // ToTemporalDate - "get options.relativeTo.timeZone.getOffsetNanosecondsFor", - "call options.relativeTo.timeZone.getOffsetNanosecondsFor", - // UnbalanceDurationRelative - "get options.relativeTo.calendar.dateAdd", // 11.a.ii - "call options.relativeTo.calendar.dateAdd", // 11.a.iii.1 MoveRelativeDate - "call options.relativeTo.calendar.dateAdd", // 11.a.iv.1 MoveRelativeDate - "call options.relativeTo.calendar.dateAdd", // 11.a.v.1 MoveRelativeDate - // UnbalanceDurationRelative again for the second argument: - "get options.relativeTo.calendar.dateAdd", // 11.a.ii - "call options.relativeTo.calendar.dateAdd", // 11.a.iii.1 MoveRelativeDate - "call options.relativeTo.calendar.dateAdd", // 11.a.iv.1 MoveRelativeDate - "call options.relativeTo.calendar.dateAdd", // 11.a.v.1 MoveRelativeDate - ] -); +// order of observable operations with zoned relativeTo and calendar units Temporal.Duration.compare( createDurationPropertyBagObserver("one", 1, 1, 1), createDurationPropertyBagObserver("two", 1, 1, 1, 1), createOptionsObserver(zonedRelativeTo) ); -assert.compareArray(actual, expectedOpsForDayBalancing, "order of operations with calendar units"); +assert.compareArray( + actual, + expectedOpsForZonedRelativeTo.concat(expectedOpsForZonedCalendarCompare), + "order of operations with ZonedDateTime relativeTo and calendar units" +); +actual.splice(0); // clear