From 24ae91a39f57bc6d133ae518eed8a274e4c0a9c2 Mon Sep 17 00:00:00 2001 From: Paul Warren Date: Thu, 29 Jun 2023 22:50:37 +0100 Subject: [PATCH] Additional test for calling getScaleLabel on facts with no units. Closes #435 --- iXBRLViewerPlugin/viewer/src/js/fact.test.js | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/iXBRLViewerPlugin/viewer/src/js/fact.test.js b/iXBRLViewerPlugin/viewer/src/js/fact.test.js index 3c6e0bb64..3574c6ca3 100644 --- a/iXBRLViewerPlugin/viewer/src/js/fact.test.js +++ b/iXBRLViewerPlugin/viewer/src/js/fact.test.js @@ -441,6 +441,34 @@ describe("Readable accuracy", () => { }); }); +describe("Readable accuracy", () => { + test("With units", () => { + expect(testFact({ + "v": "1234", + "d": 4, + "a": { "u": "iso4217:GBP" } + }).getScaleLabel(-2)).toBe("pence"); + expect(testFact({ + "v": "1234", + "d": 4, + "a": { "u": "iso4217:GBP" } + }).getScaleLabel(-4)).toBe(null); + }); + test("Without units", () => { + expect(testFact({ + "v": "1234", + "d": 4, + "a": {} + }).getScaleLabel(-2)).toBe("hundredths"); + expect(testFact({ + "v": "1234", + "d": 4, + "a": {} + }).getScaleLabel(-4)).toBe(null); + }); +}); + + describe("Readable scale", () => { test("Non-numeric", () => { expect(testFact({