Skip to content

Commit 3102bbf

Browse files
authored
Add test for loadOme with fixtures (#942)
* Test loadOme function * Rename test file * Format
1 parent 8c9b762 commit 3102bbf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/loaders/tests/demo-base64-store.spec.js renamed to packages/loaders/tests/zarr-load-ome-with-json-stores.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect, test } from 'vitest';
22
import * as zarr from 'zarrita';
3+
import { load as loadOme } from '../src/zarr/ome-zarr';
34
import { createStoreFromMapContents } from './base64-store';
45

56
import ome_ngff_0_4_fixture from './fixtures/ome-zarr/blobs_image_v04.ome.zarr.json';
@@ -35,3 +36,25 @@ test('Check that JSON-based store fixtures can be loaded: NGFF v0.5', async () =
3536
expect.arrayContaining(['omero', 'version', 'multiscales'])
3637
);
3738
});
39+
40+
test('Test loadOme function with NGFF v0.4 image', async () => {
41+
const store = createStoreFromMapContents(ome_ngff_0_4_fixture);
42+
const { data, metadata } = await loadOme(store);
43+
44+
expect(data).toBeTruthy();
45+
expect(metadata).toBeTruthy();
46+
expect(metadata.multiscales[0].name).toEqual('/images/blobs_image');
47+
expect(data.length).toBe(1); // One resolution
48+
expect(data[0].labels).toEqual(['c', 'y', 'x']);
49+
});
50+
51+
test('Test loadOme function with NGFF v0.5 image', async () => {
52+
const store = createStoreFromMapContents(ome_ngff_0_5_fixture);
53+
const { data, metadata } = await loadOme(store);
54+
55+
expect(data).toBeTruthy();
56+
expect(metadata).toBeTruthy();
57+
expect(metadata.multiscales[0].name).toEqual('/images/blobs_image');
58+
expect(data.length).toBe(1); // One resolution
59+
expect(data[0].labels).toEqual(['c', 'y', 'x']);
60+
});

0 commit comments

Comments
 (0)