Skip to content

Commit f233388

Browse files
authored
chore: cleanup unit tests (#95)
1 parent a84eba3 commit f233388

File tree

3 files changed

+393
-1366
lines changed

3 files changed

+393
-1366
lines changed

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- **Zero dependencies** (optionally
88
[`scijs/ndarray`](https://github.com/scijs/ndarray))
99
- Runs natively in **Node**, **Browsers**, and **Deno** (ESM)
10-
- Supports **v2** or **v3** protocols, C & F-order arrays, and diverse
11-
data-types
10+
- Supports **v2** or **v3** protocols, C & F-order arrays, diverse data-types,
11+
and [ZEP2 Sharding](https://zarr.dev/zeps/draft/ZEP0002.html)
1212
- Allows flexible **storage** backends and **compression** codecs
1313
- Provides rich, in-editor **type information** via
1414
[template literal types](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html)
@@ -17,9 +17,8 @@
1717

1818
```javascript
1919
import * as zarr from "zarrita";
20-
import { FetchStore } from "@zarrita/storage";
2120

22-
const store = new FetchStore("http://localhost:8080/data.zarr");
21+
const store = new zarr.FetchStore("http://localhost:8080/data.zarr");
2322
const arr = await zarr.open(store, { kind: "array" }); // zarr.Array<DataType, FetchStore>
2423

2524
// read chunk
@@ -36,6 +35,8 @@ const full = await get(arr); // ndarray.Ndarray<Int32Array>
3635
const region = await get(arr, [null, zarr.slice(6)]);
3736
```
3837

38+
Read [the documentation](https://manzt.github.io/zarrita.js) to learn more.
39+
3940
### Zarr building blocks
4041

4142
zarrita's API is almost entirely tree-shakeable, meaning users are able to pick
@@ -116,3 +117,14 @@ pnpm install
116117
pnpm build
117118
pnpm test
118119
```
120+
121+
The tests are run with [Vitest](https://github.com/vitest-dev/vitest), which is
122+
a Node.js test runner. To try our a development version of **zarrita** in the
123+
browser, run `pnpm build` and start a web-server in the root of the repository:
124+
125+
```sh
126+
python3 -m http.server .
127+
# navigate to localhost:8000
128+
```
129+
130+
You can edit the contents of `index.html` and refresh the page.

index.html

+16-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"3d.chunked.mixed.i2.F",
5858
"3d.contiguous.i2",
5959
]) {
60-
let arr = await zarr.open.v2(grp.resolve(fixture), { kind: "array" });
60+
let arr = await zarr.open.v2(grp.resolve(fixture), { kind: "array", attrs: false });
6161
let { data, shape, stride } = await get(arr);
6262
let pre = document.createElement("pre");
6363
pre.textContent = `\
@@ -76,23 +76,38 @@
7676
kind: "group",
7777
});
7878
for (let fixture of [
79+
"1d.chunked.compressed.sharded.i2",
80+
"1d.chunked.filled.compressed.sharded.i2",
7981
"1d.chunked.i2",
8082
"1d.chunked.ragged.i2",
8183
"1d.contiguous.b1",
8284
"1d.contiguous.blosc.i2",
85+
"1d.contiguous.compressed.sharded.b1",
86+
"1d.contiguous.compressed.sharded.f4",
87+
"1d.contiguous.compressed.sharded.f8",
88+
"1d.contiguous.compressed.sharded.i2",
89+
"1d.contiguous.compressed.sharded.i4",
90+
"1d.contiguous.compressed.sharded.u1",
8391
"1d.contiguous.f4.be",
8492
"1d.contiguous.f4.le",
8593
"1d.contiguous.f8",
8694
"1d.contiguous.gzip.i2",
8795
"1d.contiguous.i4",
8896
"1d.contiguous.raw.i2",
8997
"1d.contiguous.u1",
98+
"2d.chunked.compressed.sharded.filled.i2",
99+
"2d.chunked.compressed.sharded.i2",
90100
"2d.chunked.i2",
101+
"2d.chunked.ragged.compressed.sharded.i2",
91102
"2d.chunked.ragged.i2",
103+
"2d.contiguous.compressed.sharded.i2",
92104
"2d.contiguous.i2",
105+
"3d.chunked.compressed.sharded.i2",
93106
"3d.chunked.i2",
107+
"3d.chunked.mixed.compressed.sharded.i2",
94108
"3d.chunked.mixed.i2.C",
95109
"3d.chunked.mixed.i2.F",
110+
"3d.contiguous.compressed.sharded.i2",
96111
"3d.contiguous.i2",
97112
]) {
98113
let arr = await zarr.open.v3(grp.resolve(fixture), { kind: "array" });

0 commit comments

Comments
 (0)