From 6b290b6b518f89013bb17e736505eb1745ec3c25 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 Add a regression test for NumberFormat resolvedOptions. --- 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'];