Skip to content

Commit 392ba6f

Browse files
committed
Update figures test fixtures test data imports
1 parent 7113fb2 commit 392ba6f

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

packages/11ty/_plugins/figures/test/__fixtures__/figures/index.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@
44
export default {
55
annotationsCheckbox: {
66
dimensions: { height: 1455, width: 1200 },
7-
figure: require('./annotations-checkbox/figure.json'),
8-
manifest: require('./annotations-checkbox/manifest.json')
7+
figure: await import('./annotations-checkbox/figure.json', { assert: { type: 'json' }),
8+
manifest: await import('./annotations-checkbox/manifest.json', { assert: { type: 'json' })
99
},
1010
annotationsRadio: {
1111
dimensions: { height: 2868, width: 2082 },
12-
figure: require('./annotations-radio/figure.json'),
13-
manifest: require('./annotations-radio/manifest.json')
12+
figure: await import('./annotations-radio/figure.json', { assert: { type: 'json' }),
13+
manifest: await import('./annotations-radio/manifest.json', { assert: { type: 'json' })
1414
},
1515
sequence: {
1616
dimensions: { height: 2160, width: 1827 },
17-
figure: require('./sequence/figure.json'),
18-
files: require('./sequence/files.json'),
19-
manifest: require('./sequence/manifest.json')
17+
figure: await import('./sequence/figure.json', { assert: { type: 'json' }),
18+
files: await import('./sequence/files.json', { assert: { type: 'json' }),
19+
manifest: await import('./sequence/manifest.json', { assert: { type: 'json' })
2020
},
2121
sequenceWithAnnotations: {
2222
dimensions: { height: 2048, width: 1536 },
23-
figure: require('./sequence-with-annotations/figure.json'),
24-
files: require('./sequence-with-annotations/files.json'),
25-
manifest: require('./sequence-with-annotations/manifest.json')
23+
figure: await import('./sequence-with-annotations/figure.json', { assert: { type: 'json' }),
24+
files: await import('./sequence-with-annotations/files.json', { assert: { type: 'json' }),
25+
manifest: await import('./sequence-with-annotations/manifest.json', { assert: { type: 'json' })
2626
},
2727
zoomable: {
2828
dimensions: { height: 3221, width: 4096 },
29-
figure: require('./zoomable/figure.json'),
30-
manifest: require('./zoomable/manifest.json')
29+
figure: await import('./zoomable/figure.json', { assert: { type: 'json' }),
30+
manifest: await import('./zoomable/manifest.json', { assert: { type: 'json' })
3131
},
3232
zoomableSequence: {
3333
dimensions: { height: 2160, width: 1827 },
34-
figure: require('./zoomable-sequence/figure.json'),
35-
files: require('./zoomable-sequence/files.json'),
36-
manifest: require('./zoomable-sequence/manifest.json')
34+
figure: await import('./zoomable-sequence/figure.json', { assert: { type: 'json' }),
35+
files: await import('./zoomable-sequence/files.json', { assert: { type: 'json' }),
36+
manifest: await import('./zoomable-sequence/manifest.json', { assert: { type: 'json' })
3737
}
3838
}

packages/11ty/_plugins/figures/test/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { describe, test } from 'node:test'
22
import { readFile } from 'node:fs/promises'
33
import { resolve } from 'node:path'
44
import Ajv from 'ajv'
5-
import Figure from '../figure.js'
5+
import Figure from '../index.js'
66
import Manifest from '../iiif/manifest.js'
77
import assert from 'assert/strict'
88
import figureFixtures from './__fixtures__/figures/index.js'
9-
require('module-alias/register')
109

1110
const loadJson = async (filepath) => {
1211
try {

0 commit comments

Comments
 (0)