Skip to content

Commit 05fadb9

Browse files
test(stdio): add coverage for empty lines in ReadBuffer
1 parent 55a5dc4 commit 05fadb9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/core/test/shared/stdio.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ test('should be reusable after clearing', () => {
3535
});
3636

3737
describe('non-JSON line filtering', () => {
38+
test('should skip empty lines', () => {
39+
const readBuffer = new ReadBuffer();
40+
readBuffer.append(Buffer.from('\n\n' + JSON.stringify(testMessage) + '\n\n'));
41+
42+
expect(readBuffer.readMessage()).toEqual(testMessage);
43+
expect(readBuffer.readMessage()).toBeNull();
44+
});
45+
3846
test('should skip non-JSON lines before a valid message', () => {
3947
const readBuffer = new ReadBuffer();
4048
readBuffer.append(Buffer.from('Debug: Starting server\n' + 'Warning: Something happened\n' + JSON.stringify(testMessage) + '\n'));

0 commit comments

Comments
 (0)