1- import { promises } from 'node:fs' ;
2- import { cwd } from 'node:process' ;
3- import { join } from 'node:path' ;
4- import { describe , expect } from 'vitest' ;
5- import { normalize , serialize , serializeConfigPresentation4 , validatePresentation4 } from '../../src/presentation-4' ;
1+ import { promises } from "node:fs" ;
2+ import { join } from "node:path" ;
3+ import { cwd } from "node:process" ;
4+ import { describe , expect } from "vitest" ;
5+ import { normalize , serialize , serializeConfigPresentation4 } from "../../src/presentation-4" ;
6+ import { validatePresentation4 } from "../../src/presentation-4/validator" ;
67
78const { readFile, readdir } = promises ;
89
9- describe ( ' Presentation 4 smoke tests' , async ( ) => {
10+ describe ( " Presentation 4 smoke tests" , async ( ) => {
1011 const skipThese = [
1112 // Contains intentionally cyclic references in `partOf` metadata.
12- ' 10-directional-light-rotated.json' ,
13+ " 10-directional-light-rotated.json" ,
1314 ] ;
1415
15- const files = await readdir ( join ( cwd ( ) , 'fixtures/presentation-4' ) ) ;
16- const tests = files
17- . filter ( ( item ) => item . endsWith ( '.json' ) && ! skipThese . includes ( item ) )
18- . map ( ( item ) => [ item ] ) ;
16+ const files = await readdir ( join ( cwd ( ) , "fixtures/presentation-4" ) ) ;
17+ const tests = files . filter ( ( item ) => item . endsWith ( ".json" ) && ! skipThese . includes ( item ) ) . map ( ( item ) => [ item ] ) ;
1918
20- test . each ( tests ) ( ' Smoke test: ./fixtures/presentation-4/%s' , ( async ( id : string ) => {
21- const json = await readFile ( join ( cwd ( ) , ' fixtures/presentation-4' , `${ id } ` ) ) ;
19+ test . each ( tests ) ( " Smoke test: ./fixtures/presentation-4/%s" , ( async ( id : string ) => {
20+ const json = await readFile ( join ( cwd ( ) , " fixtures/presentation-4" , `${ id } ` ) ) ;
2221 const jsonString = json . toString ( ) ;
2322 const manifest = JSON . parse ( jsonString ) ;
2423 const result = normalize ( manifest ) ;
2524
26- expect ( result . resource . type ) . toEqual ( ' Manifest' ) ;
25+ expect ( result . resource . type ) . toEqual ( " Manifest" ) ;
2726 expect ( result . entities . Manifest [ result . resource . id ] ) . toBeTruthy ( ) ;
2827
29- const report = validatePresentation4 ( manifest , { mode : ' tolerant' } ) ;
28+ const report = validatePresentation4 ( manifest , { mode : " tolerant" } ) ;
3029 expect ( Array . isArray ( report . issues ) ) . toBe ( true ) ;
3130
3231 const reserialized = serialize (
@@ -39,10 +38,10 @@ describe('Presentation 4 smoke tests', async () => {
3938 serializeConfigPresentation4
4039 ) as any ;
4140
42- expect ( reserialized ) . toHaveProperty ( ' type' ) ;
43- expect ( reserialized ) . toHaveProperty ( 'id' ) ;
41+ expect ( reserialized ) . toHaveProperty ( " type" ) ;
42+ expect ( reserialized ) . toHaveProperty ( "id" ) ;
4443 expect ( reserialized . type ) . toEqual ( manifest . type ) ;
4544 expect ( reserialized . id ) . toEqual ( manifest . id ) ;
46- expect ( reserialized [ ' @context' ] ) . toEqual ( ' http://iiif.io/api/presentation/4/context.json' ) ;
45+ expect ( reserialized [ " @context" ] ) . toEqual ( " http://iiif.io/api/presentation/4/context.json" ) ;
4746 } ) as any ) ;
4847} ) ;
0 commit comments