@@ -160,6 +160,18 @@ describe('WriteAheadLogFile', () => {
160160 vol . fromJSON ( { } , MEMFS_VOLUME ) ;
161161 } ) ;
162162
163+ it ( 'should act as WLA for any kind of data' , ( ) => {
164+ const w = wal ( '/test/a.log' , stringCodec < object > ( ) ) ;
165+ w . open ( ) ;
166+ w . append ( { id : 1 , name : 'test' } ) ;
167+ w . close ( ) ;
168+ expect ( w . recover ( ) ) . toStrictEqual ( { id : 1 , name : 'test' } ) ;
169+ expect ( ( ) =>
170+ w . append ( '{ id: 1, name:...' as unknown as object ) ,
171+ ) . not . toThrow ( ) ;
172+ w . expect ( w . recover ( ) ) . toStrictEqual ( { id : 1 , name : 'test' } ) ;
173+ } ) ;
174+
163175 it ( 'should create instance with file path and codecs without opening' , ( ) => {
164176 const w = wal ( '/test/a.log' ) ;
165177 expect ( w ) . toBeInstanceOf ( WriteAheadLogFile ) ;
@@ -797,8 +809,12 @@ describe('ShardedWal', () => {
797809 const files = ( sw as any ) . shardFiles ( ) ;
798810
799811 expect ( files ) . toHaveLength ( 2 ) ;
800- expect ( files ) . toContain ( '/shards/wal.1.log' ) ;
801- expect ( files ) . toContain ( '/shards/wal.2.log' ) ;
812+ expect ( files ) . toEqual (
813+ expect . arrayContaining ( [
814+ expect . pathToMatch ( '/shards/wal.1.log' ) ,
815+ expect . pathToMatch ( '/shards/wal.2.log' ) ,
816+ ] ) ,
817+ ) ;
802818 } ) ;
803819
804820 it ( 'should finalize empty shards to empty result' , ( ) => {
0 commit comments