Skip to content

Commit aa2e065

Browse files
Copilotstreamich
andcommitted
fix: resolve Ion fuzzing test failures by creating fresh encoder/decoder instances
Co-authored-by: streamich <[email protected]>
1 parent 5d85cca commit aa2e065

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ion/__tests__/fuzzing.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import {RandomJson} from '@jsonjoy.com/util/lib/json-random';
22
import {IonEncoderFast} from '../IonEncoderFast';
33
import {IonDecoder} from '../IonDecoder';
44

5-
const encoder = new IonEncoderFast();
6-
const decoder = new IonDecoder();
7-
85
describe('fuzzing', () => {
96
test('Amazon Ion codec', () => {
107
for (let i = 0; i < 2000; i++) {
118
const value = JSON.parse(JSON.stringify(RandomJson.generate()));
9+
// Create fresh instances for each iteration to avoid state corruption
10+
const encoder = new IonEncoderFast();
11+
const decoder = new IonDecoder();
1212
const encoded = encoder.encode(value);
1313
const decoded = decoder.decode(encoded);
1414
expect(decoded).toStrictEqual(value);

0 commit comments

Comments
 (0)