1414 */
1515
1616import { CMap , CMapFactory , IdentityCMap } from "../../src/core/cmap.js" ;
17- import { CMAP_URL , DefaultCMapReaderFactory } from "./test_utils.js" ;
17+ import {
18+ CMAP_URL ,
19+ DefaultCMapReaderFactory ,
20+ fetchBuiltInCMapHelper ,
21+ } from "./test_utils.js" ;
1822import { Name } from "../../src/core/primitives.js" ;
1923import { StringStream } from "../../src/core/stream.js" ;
2024
2125describe ( "cmap" , function ( ) {
2226 let fetchBuiltInCMap ;
2327
2428 beforeAll ( function ( ) {
25- // Allow CMap testing in Node.js, e.g. for Travis.
2629 const CMapReaderFactory = new DefaultCMapReaderFactory ( {
2730 baseUrl : CMAP_URL ,
2831 } ) ;
2932
30- fetchBuiltInCMap = function ( name ) {
31- return CMapReaderFactory . fetch ( {
32- name,
33- } ) ;
34- } ;
33+ fetchBuiltInCMap = name =>
34+ fetchBuiltInCMapHelper ( CMapReaderFactory , /* cMapPacked = */ true , name ) ;
3535 } ) ;
3636
3737 afterAll ( function ( ) {
@@ -206,7 +206,11 @@ describe("cmap", function () {
206206 it ( "attempts to load a built-in CMap without the necessary API parameters" , async function ( ) {
207207 function tmpFetchBuiltInCMap ( name ) {
208208 const CMapReaderFactory = new DefaultCMapReaderFactory ( { } ) ;
209- return CMapReaderFactory . fetch ( { name } ) ;
209+ return fetchBuiltInCMapHelper (
210+ CMapReaderFactory ,
211+ /* cMapPacked = */ true ,
212+ name
213+ ) ;
210214 }
211215
212216 try {
@@ -221,7 +225,7 @@ describe("cmap", function () {
221225 } catch ( reason ) {
222226 expect ( reason ) . toBeInstanceOf ( Error ) ;
223227 expect ( reason . message ) . toEqual (
224- "Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided."
228+ "Ensure that the `cMapUrl` API parameter is provided."
225229 ) ;
226230 }
227231 } ) ;
@@ -230,9 +234,12 @@ describe("cmap", function () {
230234 function tmpFetchBuiltInCMap ( name ) {
231235 const CMapReaderFactory = new DefaultCMapReaderFactory ( {
232236 baseUrl : CMAP_URL ,
233- isCompressed : false ,
234237 } ) ;
235- return CMapReaderFactory . fetch ( { name } ) ;
238+ return fetchBuiltInCMapHelper (
239+ CMapReaderFactory ,
240+ /* cMapPacked = */ false ,
241+ name
242+ ) ;
236243 }
237244
238245 try {
0 commit comments