Skip to content

Commit

Permalink
Merge pull request #38 from IIIF-Commons/feature/image-profile-bug
Browse files Browse the repository at this point in the history
Fixed upgrading of level1 and level0 images services
  • Loading branch information
stephenwf authored May 9, 2024
2 parents 37f2046 + f1bee70 commit 9998e24
Show file tree
Hide file tree
Showing 3 changed files with 1,565 additions and 1 deletion.
25 changes: 25 additions & 0 deletions __tests__/presentation-2-parser/upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Validator } from '@hyperion-framework/validator';
import annoList from '../../fixtures/presentation-2/iiif-fixture-annotation-list.json';
import choiceAnnoList from '../../fixtures/presentation-2/anno_list_choice.json';
import loc from '../../fixtures/presentation-2/loc.json';
import level0manifest from '../../fixtures/presentation-2/manifest-l0.json';
import artic from '../../fixtures/presentation-2/artic-manifest.json';
import bodyChoice from '../../fixtures/presentation-2/body-choice.json';

Expand Down Expand Up @@ -256,6 +257,22 @@ describe('Presentation 2 to 3', () => {

expect(validator.validators.manifest!.errors).toEqual(null);
expect(isValid).toEqual(true);

// Check profile matches.
const firstCanvas = result.items[0]; // first canvas
const page = firstCanvas!.items![0]; // first page
const annotation = page!.items![0]; // first annotation
const service = (annotation!.body as any)!.service;

expect(service).toMatchInlineSnapshot(`
[
{
"@id": "https://content.staatsbibliothek-berlin.de/dc/840973497-0001",
"@type": "ImageService2",
"profile": "level1",
},
]
`);
});

test('Codex manifest', () => {
Expand All @@ -266,6 +283,14 @@ describe('Presentation 2 to 3', () => {
expect(isValid).toEqual(true);
});

test('presentation 2 with level 0', () => {
const result = presentation2to3.traverseManifest(level0manifest as any);
const isValid = validator.validateManifest(result);

expect(validator.validators.manifest!.errors).toEqual(null);
expect(isValid).toEqual(true);
});

test('Wikimedia proxy manifest', () => {
const result = presentation2to3.traverseManifest(wikimediaProxy as any);

Expand Down
Loading

0 comments on commit 9998e24

Please sign in to comment.