From f78a8f3c54efdd0ad5c1abd1683e6d3da590d712 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 3 Nov 2024 11:25:19 +0100 Subject: [PATCH] Use the `toBase64Util` helper function in the unit-tests --- test/unit/display_utils_spec.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/unit/display_utils_spec.js b/test/unit/display_utils_spec.js index f5957e6c8e01c..eef734a836966 100644 --- a/test/unit/display_utils_spec.js +++ b/test/unit/display_utils_spec.js @@ -19,7 +19,7 @@ import { isValidFetchUrl, PDFDateString, } from "../../src/display/display_utils.js"; -import { bytesToString } from "../../src/shared/util.js"; +import { toBase64Util } from "../../src/shared/util.js"; describe("display_utils", function () { describe("getFilenameFromUrl", function () { @@ -179,9 +179,8 @@ describe("display_utils", function () { }); it('gets fallback filename from query string appended to "data:" URL', function () { - const typedArray = new Uint8Array([1, 2, 3, 4, 5]), - str = bytesToString(typedArray); - const dataUrl = `data:application/pdf;base64,${btoa(str)}`; + const typedArray = new Uint8Array([1, 2, 3, 4, 5]); + const dataUrl = `data:application/pdf;base64,${toBase64Util(typedArray)}`; // Sanity check to ensure that a "data:" URL was returned. expect(dataUrl.startsWith("data:")).toEqual(true);