From a2df5772c93af5596c590d83cd3843b5b95df48e Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 15 Jul 2021 13:00:19 -0400 Subject: [PATCH] test: add NumberFormat resolvedOptions test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a regression test for NumberFormat resolvedOptions. PR-URL: https://github.com/nodejs/node/pull/39401 Refs: https://github.com/nodejs/node/issues/39050 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen --- test/parallel/test-intl.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index ba803973829b8a..956383c5281389 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -104,6 +104,13 @@ if (!common.hasIntl) { const numberFormat = new Intl.NumberFormat(['en']).format(12345.67890); assert.strictEqual(numberFormat, '12,345.679'); } + // Number format resolved options + { + const numberFormat = new Intl.NumberFormat('en-US', { style: 'percent' }); + const resolvedOptions = numberFormat.resolvedOptions(); + assert.strictEqual(resolvedOptions.locale, 'en-US'); + assert.strictEqual(resolvedOptions.style, 'percent'); + } // Significant Digits { const loc = ['en-US'];