@@ -9,48 +9,46 @@ pluginTester({
99 pluginOptions : {
1010 minJSONStringSize : 0
1111 } ,
12- code : `const a = {}; ` ,
13- output : `const a = JSON.parse('{}'); `
12+ code : `const a = {}` ,
13+ output : `const a = JSON.parse('{}')`
1414 } , {
1515 title : 'respects minJSONStringSize (default : 1024)' ,
16- code : `const a = { b: 1, c: 2 }; ` ,
16+ code : `const a = { b: 1, c: 2 }` ,
1717 output : `
1818 const a = {
1919 b: 1,
2020 c: 2
21- };
21+ }
2222 `
2323 } , {
2424 title : 'respects minJSONStringSize' ,
2525 pluginOptions : {
2626 minJSONStringSize : 15
2727 } ,
28- code : `const a = { b: 1, c: 2 }; ` ,
28+ code : `const a = { b: 1, c: 2 }` ,
2929 output : `
3030 const a = {
3131 b: 1,
3232 c: 2
33- };
33+ }
3434 `
3535 } , {
3636 title : 'respects minJSONStringSize' ,
3737 pluginOptions : {
3838 minJSONStringSize : 0
3939 } ,
40- code : `const a = { b: 1, c: 2 }; ` ,
40+ code : `const a = { b: 1, c: 2 }` ,
4141 output : `
42- const a = JSON.parse('{"b":1,"c":2}');
42+ const a = JSON.parse('{"b":1,"c":2}')
4343 `
4444 } , {
4545 title : 'does not convert objects which include the spread syntax' ,
46- code : `const a = { ...a, b: 1 }; ` ,
46+ code : `const a = { ...a, b: 1 }` ,
4747 pluginOptions : {
4848 minJSONStringSize : 0
4949 } ,
5050 output : `
51- const a = { ...a,
52- b: 1
53- };
51+ const a = { ...a, b: 1 }
5452 `
5553 } , {
5654 title : 'does not convert objects which include the object method' ,
@@ -60,145 +58,145 @@ pluginTester({
6058 code : `
6159 const a = {
6260 method(arg) {
63- return arg;
61+ return arg
6462 },
6563 b: 1
66- };
64+ }
6765 ` ,
6866 output : `
6967 const a = {
7068 method(arg) {
71- return arg;
69+ return arg
7270 },
7371
7472 b: 1
75- };
73+ }
7674 `
7775 } , {
7876 title : 'does not convert objects which include the invalid value' ,
7977 pluginOptions : {
8078 minJSONStringSize : 0
8179 } ,
82- code : `const a = { b: () => console.log("b" ) }; ` ,
80+ code : `const a = { b: () => console.log('b' ) }` ,
8381 output : `
8482 const a = {
85- b: () => console.log("b" )
86- };
83+ b: () => console.log('b' )
84+ }
8785 `
8886 } , {
8987 title : 'does not convert objects which have computed property names' ,
9088 pluginOptions : {
9189 minJSONStringSize : 0
9290 } ,
93- code : `const a = { b : " b_val" , ["c" ]: " c_val" }; ` ,
91+ code : `const a = { b : ' b_val' , ['c' ]: ' c_val' } ` ,
9492 output : `
9593 const a = {
96- b: " b_val" ,
97- ["c" ]: " c_val"
98- };
94+ b: ' b_val' ,
95+ ['c' ]: ' c_val'
96+ }
9997 `
10098 } , {
10199 title : 'does not convert objects which have double quotes in string' ,
102100 pluginOptions : {
103101 minJSONStringSize : 0
104102 } ,
105- code : `const a = { b: 'ab\"c' }; ` ,
103+ code : `const a = { b: 'ab\"c' }` ,
106104 output : `
107105 const a = {
108106 b: 'ab\"c'
109- };
107+ }
110108 `
111109 } , {
112110 title : 'does not convert objects which have double quotes in string' ,
113111 pluginOptions : {
114112 minJSONStringSize : 0
115113 } ,
116- code : `const a = { b: 'ab"c' }; ` ,
114+ code : `const a = { b: 'ab"c' }` ,
117115 output : `
118116 const a = {
119117 b: 'ab"c'
120- };
118+ }
121119 `
122120 } , {
123121 title : 'does not convert objects which have invalid numeric key' ,
124122 pluginOptions : {
125123 minJSONStringSize : 0
126124 } ,
127- code : `const a ={ 77777777777777777.1: " foo" }; ` ,
125+ code : `const a ={ 77777777777777777.1: ' foo' } ` ,
128126 output : `
129127 const a = {
130- 77777777777777777.1: " foo"
131- };
128+ 77777777777777777.1: ' foo'
129+ }
132130 `
133131 } , {
134132 title : 'string' ,
135133 pluginOptions : {
136134 minJSONStringSize : 0
137135 } ,
138- code : `const a = { b: "b_val" }; ` ,
139- output : `const a = JSON.parse('{"b":"b_val"}'); `
136+ code : `const a = { b: "b_val" }` ,
137+ output : `const a = JSON.parse('{"b":"b_val"}')`
140138 } , {
141139 title : 'string (include single quote)' ,
142140 pluginOptions : {
143141 minJSONStringSize : 0
144142 } ,
145- code : `const a = { b: "'abc'" }; ` ,
146- output : `const a = JSON.parse('{"b":"\\'abc\\'"}'); `
143+ code : `const a = { b: "'abc'" }` ,
144+ output : `const a = JSON.parse('{"b":"\\'abc\\'"}')`
147145 } , {
148146 title : 'string (include single quote)' ,
149147 pluginOptions : {
150148 minJSONStringSize : 0
151149 } ,
152- code : `const a = { b: "ab\'c" }; ` ,
153- output : `const a = JSON.parse('{"b":"ab\\'c"}'); `
150+ code : `const a = { b: "ab\'c" }` ,
151+ output : `const a = JSON.parse('{"b":"ab\\'c"}')`
154152 } , {
155153 title : 'number' ,
156154 pluginOptions : {
157155 minJSONStringSize : 0
158156 } ,
159- code : `const a = { b: 1 }; ` ,
160- output : `const a = JSON.parse('{"b":1}'); `
157+ code : `const a = { b: 1 }` ,
158+ output : `const a = JSON.parse('{"b":1}')`
161159 } , {
162160 title : 'null' ,
163161 pluginOptions : {
164162 minJSONStringSize : 0
165163 } ,
166- code : `const a = { b: null }; ` ,
167- output : `const a = JSON.parse('{"b":null}'); `
164+ code : `const a = { b: null }` ,
165+ output : `const a = JSON.parse('{"b":null}')`
168166 } , {
169167 title : 'boolean' ,
170168 pluginOptions : {
171169 minJSONStringSize : 0
172170 } ,
173- code : `const a = { b: false }; ` ,
174- output : `const a = JSON.parse('{"b":false}'); `
171+ code : `const a = { b: false }` ,
172+ output : `const a = JSON.parse('{"b":false}')`
175173 } , {
176174 title : 'Array' ,
177175 pluginOptions : {
178176 minJSONStringSize : 0
179177 } ,
180- code : `const a = { b: [1, 'b_val', null] }; ` ,
181- output : `const a = JSON.parse('{"b":[1,"b_val",null]}'); `
178+ code : `const a = { b: [1, 'b_val', null] }` ,
179+ output : `const a = JSON.parse('{"b":[1,"b_val",null]}')`
182180 } , {
183181 title : 'Nested Array' ,
184182 pluginOptions : {
185183 minJSONStringSize : 0
186184 } ,
187- code : `const a = { b: [1, ['b_val', { a: 1 }], null] }; ` ,
188- output : `const a = JSON.parse('{"b":[1,["b_val",{"a":1}],null]}'); `
185+ code : `const a = { b: [1, ['b_val', { a: 1 }], null] }` ,
186+ output : `const a = JSON.parse('{"b":[1,["b_val",{"a":1}],null]}')`
189187 } , {
190188 title : 'Object' ,
191189 pluginOptions : {
192190 minJSONStringSize : 0
193191 } ,
194- code : `const a = { b: { c: 1 } }; ` ,
195- output : `const a = JSON.parse('{"b":{"c":1}}'); `
192+ code : `const a = { b: { c: 1 } }` ,
193+ output : `const a = JSON.parse('{"b":{"c":1}}')`
196194 } , {
197195 title : 'Object (having numeric keys)' ,
198196 pluginOptions : {
199197 minJSONStringSize : 0
200198 } ,
201- code : `const a = { 1: "123", 23: 45, b: "b_val" }; ` ,
202- output : `const a = JSON.parse('{"1":"123","23":45,"b":"b_val"}'); `
199+ code : `const a = { 1: "123", 23: 45, b: "b_val" }` ,
200+ output : `const a = JSON.parse('{"1":"123","23":45,"b":"b_val"}')`
203201 } , ]
204202} )
0 commit comments