File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -668,11 +668,17 @@ describe('parsePackFile', () => {
668
668
expect ( ( ) => parsePacketLines ( invalidLengthBuffer ) ) . to . throw ( / I n v a l i d p a c k e t l i n e l e n g t h 0 0 0 A / ) ;
669
669
} ) ;
670
670
671
- it ( 'should throw an error for non-hex length prefix' , ( ) => {
671
+ it ( 'should throw an error for non-hex length prefix (all non-hex) ' , ( ) => {
672
672
const invalidHexBuffer = Buffer . from ( 'XXXXline' ) ;
673
673
expect ( ( ) => parsePacketLines ( invalidHexBuffer ) ) . to . throw ( / I n v a l i d p a c k e t l i n e l e n g t h X X X X / ) ;
674
674
} ) ;
675
675
676
+ it ( 'should throw an error for non-hex length prefix (non-hex at the end)' , ( ) => {
677
+ // Cover the quirk of parseInt returning 0 instead of NaN
678
+ const invalidHexBuffer = Buffer . from ( '000zline' ) ;
679
+ expect ( ( ) => parsePacketLines ( invalidHexBuffer ) ) . to . throw ( / I n v a l i d p a c k e t l i n e l e n g t h 0 0 0 z / ) ;
680
+ } ) ;
681
+
676
682
it ( 'should handle buffer ending exactly after a valid line length without content' , ( ) => {
677
683
// 0008 -> length 8, but buffer ends after header (no content)
678
684
const incompleteBuffer = Buffer . from ( '0008' ) ;
You can’t perform that action at this time.
0 commit comments