Skip to content

Commit 024c4ca

Browse files
committed
update tests
1 parent 13fa72a commit 024c4ca

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

packages/replay/test/unit/eventBuffer.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ describe('Unit | eventBuffer', () => {
5252
}) as EventBufferCompressionWorker;
5353

5454
buffer.addEvent(TEST_EVENT);
55+
// @ts-ignore make sure it handles invalid data
56+
buffer.addEvent(undefined);
5557
buffer.addEvent(TEST_EVENT);
5658

5759
const result = await buffer.finish();

packages/replay/test/unit/worker/Compressor.test.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,16 @@ describe('Unit | worker | Compressor', () => {
2626
expect(restored).toBe(JSON.stringify(events));
2727
});
2828

29-
it('ignores undefined events', () => {
29+
it('throws on invalid/undefined events', () => {
3030
const compressor = new Compressor();
3131

32-
const events = [
33-
{
34-
id: 1,
35-
foo: ['bar', 'baz'],
36-
},
37-
undefined,
38-
{
39-
id: 2,
40-
foo: [false],
41-
},
42-
] as Record<string, any>[];
43-
44-
events.forEach(event => compressor.addEvent(event));
32+
// @ts-ignore ignoring type for test
33+
expect(() => void compressor.addEvent(undefined)).toThrow();
4534

4635
const compressed = compressor.finish();
4736

4837
const restored = pako.inflate(compressed, { to: 'string' });
4938

50-
const expected = [events[0], events[2]];
51-
expect(restored).toBe(JSON.stringify(expected));
39+
expect(restored).toBe(JSON.stringify([]));
5240
});
5341
});

0 commit comments

Comments
 (0)