Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the toBase64Util helper function in the unit-tests #18999

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/unit/display_utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);

Expand Down