File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ describe('node:json', () => {
5353 ) ;
5454 } ) ;
5555
56- test ( 'throws SyntaxError on invalid JSON' , ( ) => {
56+ test ( 'throws SyntaxError on invalid string JSON' , ( ) => {
5757 assert . throws (
5858 ( ) => parse ( 'not valid json' ) ,
5959 {
@@ -62,6 +62,24 @@ describe('node:json', () => {
6262 ) ;
6363 } ) ;
6464
65+ test ( 'throws SyntaxError on invalid object JSON' , ( ) => {
66+ assert . throws (
67+ ( ) => parse ( '{"key": "property}' ) ,
68+ {
69+ name : 'SyntaxError' ,
70+ }
71+ ) ;
72+ } ) ;
73+
74+ test ( 'throws SyntaxError on invalid array JSON' , ( ) => {
75+ assert . throws (
76+ ( ) => parse ( '[1,2,3,]' ) ,
77+ {
78+ name : 'SyntaxError' ,
79+ }
80+ ) ;
81+ } ) ;
82+
6583 test ( 'parses simple object' , ( ) => {
6684 const result = parse ( '{"key":"value"}' ) ;
6785 assert . deepStrictEqual ( result , { key : 'value' } ) ;
You can’t perform that action at this time.
0 commit comments