Skip to content

Commit

Permalink
Add unit test for CaughtRuntimeError
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-Holbrook committed Jan 8, 2025
1 parent f7d9081 commit c2cbced
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/debugProtocol/events/updates/AllThreadsStoppedUpdate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,36 @@ describe('AllThreadsStoppedUpdate', () => {
stopReasonDetail: 'because' // 8 bytes
});
});

it('serializes and deserializes properly StopReason.CaughtRuntimeError', () => {
const command = AllThreadsStoppedUpdate.fromJson({
threadIndex: 1,
stopReason: StopReason.CaughtRuntimeError,
stopReasonDetail: 'because'
});

expect(command.data).to.eql({
packetLength: undefined,
requestId: 0,
errorCode: ErrorCode.OK,
updateType: UpdateType.AllThreadsStopped,

threadIndex: 1,
stopReason: StopReason.CaughtRuntimeError,
stopReasonDetail: 'because'
});

expect(
AllThreadsStoppedUpdate.fromBuffer(command.toBuffer()).data
).to.eql({
packetLength: 29, // 4 bytes
requestId: 0, // 4 bytes
errorCode: ErrorCode.OK, // 4 bytes
updateType: UpdateType.AllThreadsStopped, // 4 bytes

threadIndex: 1, // 4 bytes
stopReason: StopReason.CaughtRuntimeError, // 1 bytes
stopReasonDetail: 'because' // 8 bytes
});
});
});

0 comments on commit c2cbced

Please sign in to comment.