From 21440c733c9079410d826409ca5cf36680766f5e Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang <41213225+FrankYFTang@users.noreply.github.com> Date: Thu, 23 Apr 2020 13:50:34 -0700 Subject: [PATCH] Change compareArray to allow new property Change the compareArray to code which allow new property but still assert the actual output contains the expected and assert the order. --- .../resolvedOptions/order-fractionalSecondDigits.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js b/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js index c6b41fd5d1..ed5397bab0 100644 --- a/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js +++ b/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js @@ -4,7 +4,7 @@ /*--- esid: sec-intl.datetimeformat.prototype.resolvedoptions description: Verifies the property order for the object returned by resolvedOptions(). -includes: [compareArray.js] +includes: [arrayContains.js] features: [Intl.DateTimeFormat-fractionalSecondDigits] ---*/ @@ -24,4 +24,12 @@ const expected = [ "fractionalSecondDigits", ]; -assert.compareArray(Object.getOwnPropertyNames(options), expected); +let actual = Object.getOwnPropertyNames(options); + +// Ensure all expected items are in actual and also allow other property +// implemented in other new proposal. +assert(arrayContains(actual, expected)); +for (var i = 1; i < expected.length; i++) { + // Ensure the order as expected but allow additional new property in between + assert(actual.indexOf(expected[i-1]) < actual.indexOf(expected[i])); +}