Skip to content

Commit 92b525d

Browse files
committed
More tests
1 parent 98cc251 commit 92b525d

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

test/prefer-static-response-json.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,13 @@ test.snapshot({
3939
foo;
4040
new (( Response ))(JSON.stringify(data))
4141
`,
42+
outdent`
43+
foo;
44+
(( new (( Response ))(JSON.stringify(data)) ))
45+
`,
46+
outdent`
47+
foo
48+
(( new (( Response ))(JSON.stringify(data)) ))
49+
`,
4250
],
4351
});

test/snapshots/prefer-static-response-json.js.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,51 @@ Generated by [AVA](https://avajs.dev).
165165
> 2 | new (( Response ))(JSON.stringify(data))␊
166166
| ^^^^^^^^^^^^^^ Prefer using \`Response.json(…)\` over \`JSON.stringify()\`.␊
167167
`
168+
169+
## invalid(8): foo; (( new (( Response ))(JSON.stringify(data)) ))
170+
171+
> Input
172+
173+
`␊
174+
1 | foo;␊
175+
2 | (( new (( Response ))(JSON.stringify(data)) ))␊
176+
`
177+
178+
> Output
179+
180+
`␊
181+
1 | foo;␊
182+
2 | (( (( Response.json ))(data) ))␊
183+
`
184+
185+
> Error 1/1
186+
187+
`␊
188+
1 | foo;␊
189+
> 2 | (( new (( Response ))(JSON.stringify(data)) ))␊
190+
| ^^^^^^^^^^^^^^ Prefer using \`Response.json(…)\` over \`JSON.stringify()\`.␊
191+
`
192+
193+
## invalid(9): foo (( new (( Response ))(JSON.stringify(data)) ))
194+
195+
> Input
196+
197+
`␊
198+
1 | foo␊
199+
2 | (( new (( Response ))(JSON.stringify(data)) ))␊
200+
`
201+
202+
> Output
203+
204+
`␊
205+
1 | foo␊
206+
2 | (( (( Response.json ))(data) ))␊
207+
`
208+
209+
> Error 1/1
210+
211+
`␊
212+
1 | foo␊
213+
> 2 | (( new (( Response ))(JSON.stringify(data)) ))␊
214+
| ^^^^^^^^^^^^^^ Prefer using \`Response.json(…)\` over \`JSON.stringify()\`.␊
215+
`
85 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)