@@ -3,6 +3,11 @@ import assert from 'node:assert/strict'
33
44import { Storage , Repository , RepositoryConfig } from '../index'
55
6+ const decoder = new TextDecoder ( )
7+ function decodeBytes ( data : Uint8Array ) : string {
8+ return decoder . decode ( data )
9+ }
10+
611test ( 'repository lifecycle' , async ( t ) => {
712 const storage = await Storage . newInMemory ( )
813
@@ -48,7 +53,7 @@ test('session and store operations', async (t) => {
4853 await store . set ( 'zarr.json' , data )
4954 const result = await store . get ( 'zarr.json' )
5055 assert ( result )
51- assert . equal ( result ! . toString ( ) , '{"zarr_format":3,"node_type":"group"}' )
56+ assert . equal ( decodeBytes ( result ! ) , '{"zarr_format":3,"node_type":"group"}' )
5257 assert . equal ( await store . exists ( 'zarr.json' ) , true )
5358
5459 // get nonexistent returns null
@@ -104,14 +109,14 @@ test('commit, branches, and tags', async (t) => {
104109 assert . equal ( readSession . readOnly , true )
105110 const result = await readSession . store . get ( 'zarr.json' )
106111 assert ( result )
107- assert . equal ( result ! . toString ( ) , '{"zarr_format":3,"node_type":"group"}' )
112+ assert . equal ( decodeBytes ( result ! ) , '{"zarr_format":3,"node_type":"group"}' )
108113
109114 // readonly session from tag
110115 const tagSession = await repo2 . readonlySession ( { tag : 'v1.0' } )
111116 assert . equal ( tagSession . readOnly , true )
112117 const tagResult = await tagSession . store . get ( 'zarr.json' )
113118 assert ( tagResult )
114- assert . equal ( tagResult ! . toString ( ) , '{"zarr_format":3,"node_type":"group"}' )
119+ assert . equal ( decodeBytes ( tagResult ! ) , '{"zarr_format":3,"node_type":"group"}' )
115120
116121 t . pass ( )
117122} )
@@ -282,7 +287,7 @@ test('create with full manifest config', async (t) => {
282287 const readSession = await repo2 . readonlySession ( { branch : 'main' } )
283288 const result = await readSession . store . get ( 'zarr.json' )
284289 assert ( result )
285- assert . equal ( result ! . toString ( ) , '{"zarr_format":3,"node_type":"group"}' )
290+ assert . equal ( decodeBytes ( result ! ) , '{"zarr_format":3,"node_type":"group"}' )
286291
287292 t . pass ( )
288293} )
0 commit comments