Skip to content

Commit 40c43ba

Browse files
committed
test(json-crdt): 💍 add indexed JSON CRDT codec to fuzzer
1 parent 11a4934 commit 40c43ba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/json-crdt/__tests__/fuzzer/SessionLogical.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {encode as encodeJson} from '../../../json-crdt-patch/codec/verbose/encod
1010
import {Encoder as BinaryEncoder} from '../../codec/structural/binary/Encoder';
1111
import {Encoder as CompactEncoder} from '../../codec/structural/compact/Encoder';
1212
import {Encoder as JsonEncoder} from '../../codec/structural/verbose/Encoder';
13+
import {Encoder as IndexedBinaryEncoder} from '../../codec/indexed/binary/Encoder';
14+
import {Decoder as IndexedBinaryDecoder} from '../../codec/indexed/binary/Decoder';
1315
import {generateInteger} from './util';
1416
import {Model} from '../..';
1517
import {Patch} from '../../../json-crdt-patch/Patch';
@@ -27,6 +29,8 @@ const compactEncoder = new CompactEncoder();
2729
const compactDecoder = new CompactDecoder();
2830
const binaryEncoder = new BinaryEncoder();
2931
const binaryDecoder = new BinaryDecoder();
32+
const indexedBinaryEncoder = new IndexedBinaryEncoder();
33+
const indexedBinaryDecoder = new IndexedBinaryDecoder();
3034

3135
export class SessionLogical {
3236
public models: Model[] = [];
@@ -192,6 +196,7 @@ export class SessionLogical {
192196
if (randomU32(0, 1)) model = jsonDecoder.decode(jsonEncoder.encode(model));
193197
if (randomU32(0, 1)) model = compactDecoder.decode(compactEncoder.encode(model));
194198
if (randomU32(0, 1)) model = binaryDecoder.decode(binaryEncoder.encode(model));
199+
if (randomU32(0, 1)) model = indexedBinaryDecoder.decode(indexedBinaryEncoder.encode(model));
195200
}
196201
for (let j = 0; j < this.concurrency; j++) {
197202
const patches = this.patches[j];

0 commit comments

Comments
 (0)