1
+ import { describe , expect , test } from 'vitest' ;
1
2
import { ImageServiceLoader } from '../src/image-service-loader' ;
2
3
import { Service } from '../src/types' ;
3
4
import { ImageService } from '@iiif/presentation-3' ;
@@ -105,8 +106,8 @@ describe('image service loader', () => {
105
106
106
107
expect ( Object . keys ( loader . knownImageServers ) ) . toEqual ( [ 'damsssl.llgc.org.uk' ] ) ;
107
108
108
- expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] . verified ) . toEqual ( false ) ;
109
- expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] . sampledId ) . toEqual (
109
+ expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] ! . verified ) . toEqual ( false ) ;
110
+ expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] ! . sampledId ) . toEqual (
110
111
'https://damsssl.llgc.org.uk/iiif/2.0/image/4694557'
111
112
) ;
112
113
} ) ;
@@ -136,7 +137,7 @@ describe('image service loader', () => {
136
137
) . not . toEqual ( null ) ;
137
138
138
139
expect ( Object . keys ( loader . knownImageServers ) ) . toEqual ( [ 'damsssl.llgc.org.uk' ] ) ;
139
- expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] . verified ) . toEqual ( true ) ;
140
+ expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] ! . verified ) . toEqual ( true ) ;
140
141
} ) ;
141
142
142
143
test ( 'it wont predict if there is not enough verifications' , async ( ) => {
@@ -169,7 +170,7 @@ describe('image service loader', () => {
169
170
} )
170
171
) . not . toEqual ( null ) ;
171
172
172
- expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] . verifications ) . toEqual ( 1 ) ;
173
+ expect ( loader . knownImageServers [ 'damsssl.llgc.org.uk' ] ! . verifications ) . toEqual ( 1 ) ;
173
174
} ) ;
174
175
} ) ;
175
176
@@ -332,53 +333,53 @@ describe('image service loader', () => {
332
333
expect ( image3Prediction . sizes ) . toEqual ( image3 . sizes ) ;
333
334
334
335
expect ( Object . keys ( loader . knownImageServers ) ) . toEqual ( [ 'iiif.bodleian.ox.ac.uk' ] ) ;
335
- expect ( loader . knownImageServers [ 'iiif.bodleian.ox.ac.uk' ] . verified ) . toEqual ( true ) ;
336
+ expect ( loader . knownImageServers [ 'iiif.bodleian.ox.ac.uk' ] ! . verified ) . toEqual ( true ) ;
336
337
} ) ;
337
338
} ) ;
338
339
339
- describe ( 'sbb' , ( ) => {
340
- const sbbInfo = {
341
- '@context' : 'http://iiif.io/api/image/2/context.json' ,
342
- '@id' : 'https://iiif-content.crossasia.org/xasia/dllm+dllm_0005978+233695' ,
343
- '@type' : 'iiif:Image' ,
344
- protocol : 'http://iiif.io/api/image' ,
345
- width : 1741 ,
346
- height : 2381 ,
347
- sizes : [
348
- { width : 150 , height : 100 } ,
349
- {
350
- width : 600 ,
351
- height : 400 ,
352
- } ,
353
- { width : 2400 , height : 4000 } ,
354
- { width : 1722 , height : 2304 } ,
355
- ] ,
356
- tiles : [
357
- { width : 256 , scaleFactors : [ 1 ] } ,
358
- {
359
- width : 512 ,
360
- scaleFactors : [ 2 , 4 ] ,
361
- } ,
362
- { width : 1024 , scaleFactors : [ 8 , 16 ] } ,
363
- ] ,
364
- logo : {
365
- '@id' : 'https://iiif-content.crossasia.org/xasia/logo' ,
366
- service : {
367
- '@context' : 'http://iiif.io/api/image/2/context.json' ,
368
- '@id' : 'https://iiif-content.crossasia.org/xasia/logo' ,
369
- profile : 'http://iiif.io/api/image/2/level2.json' ,
370
- } ,
371
- } ,
372
- profile : [
373
- 'http://iiif.io/api/image/2/level2.json' ,
374
- {
375
- formats : [ 'jpg' , 'png' , 'webp' , 'tif' ] ,
376
- qualities : [ 'color' , 'gray' ] ,
377
- supports : [ 'canonicalLinkHeader' , 'rotationArbitrary' , 'profileLinkHeader' ] ,
378
- } ,
379
- ] ,
380
- } ;
381
- } ) ;
340
+ // describe('sbb', () => {
341
+ // const sbbInfo = {
342
+ // '@context': 'http://iiif.io/api/image/2/context.json',
343
+ // '@id': 'https://iiif-content.crossasia.org/xasia/dllm+dllm_0005978+233695',
344
+ // '@type': 'iiif:Image',
345
+ // protocol: 'http://iiif.io/api/image',
346
+ // width: 1741,
347
+ // height: 2381,
348
+ // sizes: [
349
+ // { width: 150, height: 100 },
350
+ // {
351
+ // width: 600,
352
+ // height: 400,
353
+ // },
354
+ // { width: 2400, height: 4000 },
355
+ // { width: 1722, height: 2304 },
356
+ // ],
357
+ // tiles: [
358
+ // { width: 256, scaleFactors: [1] },
359
+ // {
360
+ // width: 512,
361
+ // scaleFactors: [2, 4],
362
+ // },
363
+ // { width: 1024, scaleFactors: [8, 16] },
364
+ // ],
365
+ // logo: {
366
+ // '@id': 'https://iiif-content.crossasia.org/xasia/logo',
367
+ // service: {
368
+ // '@context': 'http://iiif.io/api/image/2/context.json',
369
+ // '@id': 'https://iiif-content.crossasia.org/xasia/logo',
370
+ // profile: 'http://iiif.io/api/image/2/level2.json',
371
+ // },
372
+ // },
373
+ // profile: [
374
+ // 'http://iiif.io/api/image/2/level2.json',
375
+ // {
376
+ // formats: ['jpg', 'png', 'webp', 'tif'],
377
+ // qualities: ['color', 'gray'],
378
+ // supports: ['canonicalLinkHeader', 'rotationArbitrary', 'profileLinkHeader'],
379
+ // },
380
+ // ],
381
+ // };
382
+ // });
382
383
383
384
describe ( 'getty quire example (level0)' , ( ) => {
384
385
const infoA = {
@@ -452,13 +453,13 @@ describe('image service loader', () => {
452
453
await loader . sample ( infoB as any ) ;
453
454
// await loader.sample();
454
455
455
- const prediection = loader . predict ( {
456
+ const prediction = loader . predict ( {
456
457
id : infoC [ '@id' ] ,
457
458
width : infoC . width as number ,
458
459
height : infoC . height as number ,
459
460
} ) as Service ;
460
461
461
- expect ( prediection ) . toEqual ( null ) ;
462
+ expect ( prediction ) . toEqual ( null ) ;
462
463
} ) ;
463
464
test ( 'C -> B -> A' , async ( ) => {
464
465
const loader = new ImageServiceLoader ( { approximateServices : true } ) ;
@@ -468,13 +469,13 @@ describe('image service loader', () => {
468
469
await loader . sample ( infoB as any ) ;
469
470
// await loader.sample();
470
471
471
- const prediection = loader . predict ( {
472
+ const prediction = loader . predict ( {
472
473
id : infoA [ '@id' ] ,
473
474
width : infoA . width as number ,
474
475
height : infoA . height as number ,
475
476
} ) as Service ;
476
477
477
- expect ( prediection ) . toEqual ( null ) ;
478
+ expect ( prediction ) . toEqual ( null ) ;
478
479
} ) ;
479
480
test ( 'A -> C -> B' , async ( ) => {
480
481
const loader = new ImageServiceLoader ( { approximateServices : true } ) ;
@@ -484,13 +485,13 @@ describe('image service loader', () => {
484
485
await loader . sample ( infoC as any ) ;
485
486
// await loader.sample();
486
487
487
- const prediection = loader . predict ( {
488
+ const prediction = loader . predict ( {
488
489
id : infoB [ '@id' ] ,
489
490
width : infoB . width as number ,
490
491
height : infoB . height as number ,
491
492
} ) as Service ;
492
493
493
- expect ( prediection ) . toEqual ( null ) ;
494
+ expect ( prediction ) . toEqual ( null ) ;
494
495
} ) ;
495
496
} ) ;
496
497
} ) ;
0 commit comments