1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #19051 from Snuffleupagus/Dict-Map

Convert the `Dict`-implementation to use a `Map` internally
This commit is contained in:
Jonas Jenwald 2024-11-17 12:59:02 +01:00 committed by GitHub
commit bc91985941
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 49 additions and 52 deletions

View file

@ -221,17 +221,12 @@ describe("primitives", function () {
expect(values[2]).toEqual(testFontFile);
});
it("should callback for each stored key", function () {
const callbackSpy = jasmine.createSpy("spy on callback in dictionary");
dictWithManyKeys.forEach(callbackSpy);
expect(callbackSpy).toHaveBeenCalled();
const callbackSpyCalls = callbackSpy.calls;
expect(callbackSpyCalls.argsFor(0)).toEqual(["FontFile", testFontFile]);
expect(callbackSpyCalls.argsFor(1)).toEqual(["FontFile2", testFontFile2]);
expect(callbackSpyCalls.argsFor(2)).toEqual(["FontFile3", testFontFile3]);
expect(callbackSpyCalls.count()).toEqual(3);
it("should iterate through each stored key", function () {
expect([...dictWithManyKeys]).toEqual([
["FontFile", testFontFile],
["FontFile2", testFontFile2],
["FontFile3", testFontFile3],
]);
});
it("should handle keys pointing to indirect objects, both sync and async", async function () {