From 07e83f77faaa80f59743f44dc45bdf5e4f30aaaa 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'];