Use the toBase64Util helper function in the unit-tests
This commit is contained in:
parent
5f77b907eb
commit
f78a8f3c54
@ -19,7 +19,7 @@ import {
|
|||||||
isValidFetchUrl,
|
isValidFetchUrl,
|
||||||
PDFDateString,
|
PDFDateString,
|
||||||
} from "../../src/display/display_utils.js";
|
} 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("display_utils", function () {
|
||||||
describe("getFilenameFromUrl", function () {
|
describe("getFilenameFromUrl", function () {
|
||||||
@ -179,9 +179,8 @@ describe("display_utils", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('gets fallback filename from query string appended to "data:" URL', function () {
|
it('gets fallback filename from query string appended to "data:" URL', function () {
|
||||||
const typedArray = new Uint8Array([1, 2, 3, 4, 5]),
|
const typedArray = new Uint8Array([1, 2, 3, 4, 5]);
|
||||||
str = bytesToString(typedArray);
|
const dataUrl = `data:application/pdf;base64,${toBase64Util(typedArray)}`;
|
||||||
const dataUrl = `data:application/pdf;base64,${btoa(str)}`;
|
|
||||||
// Sanity check to ensure that a "data:" URL was returned.
|
// Sanity check to ensure that a "data:" URL was returned.
|
||||||
expect(dataUrl.startsWith("data:")).toEqual(true);
|
expect(dataUrl.startsWith("data:")).toEqual(true);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user