@@ -55,10 +55,12 @@ ruleTester.run('test-case-shorthand-strings', rule, {
5555 {
5656 code : getTestCases ( [ '"foo"' ] ) ,
5757 options : [ 'as-needed' ] ,
58+ name : 'single string (options: as-needed)' ,
5859 } ,
5960 {
6061 code : getTestCases ( [ '"foo"' , '"bar"' ] ) ,
6162 options : [ 'as-needed' ] ,
63+ name : 'multiple strings (options: as-needed)' ,
6264 } ,
6365 {
6466 code : getTestCases ( [
@@ -67,6 +69,7 @@ ruleTester.run('test-case-shorthand-strings', rule, {
6769 '{ code: "foo", options: ["bar"] }' ,
6870 ] ) ,
6971 options : [ 'as-needed' ] ,
72+ name : 'mixed strings and object with options (options: as-needed)' ,
7073 } ,
7174 {
7275 code : getTestCases ( [
@@ -75,66 +78,79 @@ ruleTester.run('test-case-shorthand-strings', rule, {
7578 '{ code: "foo", parserOptions: ["bar"] }' ,
7679 ] ) ,
7780 options : [ 'as-needed' ] ,
81+ name : 'mixed strings and object with parserOptions (options: as-needed)' ,
7882 } ,
7983 {
8084 code : getTestCases ( [ '`foo`' ] ) ,
8185 options : [ 'as-needed' ] ,
86+ name : 'template string (options: as-needed)' ,
8287 } ,
8388 {
8489 code : getTestCases ( [ 'tag`foo`' ] ) ,
8590 options : [ 'as-needed' ] ,
91+ name : 'tagged template string (options: as-needed)' ,
8692 } ,
8793
8894 // never
8995 {
9096 code : getTestCases ( [ '{ code: "foo" }' , '{ code: "bar" }' ] ) ,
9197 options : [ 'never' ] ,
98+ name : 'objects (options: never)' ,
9299 } ,
93100 {
94101 code : getTestCases ( [ 'notAString' , '{ code: "bar" }' ] ) ,
95102 options : [ 'never' ] ,
103+ name : 'variable and object (options: never)' ,
96104 } ,
97105 {
98106 code : getTestCases ( [ 'notAString()' , '{ code: "bar" }' ] ) ,
99107 options : [ 'never' ] ,
108+ name : 'function call and object (options: never)' ,
100109 } ,
101110
102111 // consistent
103112 {
104113 code : getTestCases ( [ '"foo"' , '"bar"' ] ) ,
105114 options : [ 'consistent' ] ,
115+ name : 'multiple strings (options: consistent)' ,
106116 } ,
107117 {
108118 code : getTestCases ( [ '{ code: "foo" }' , '{ code: "bar" }' ] ) ,
109119 options : [ 'consistent' ] ,
120+ name : 'multiple objects (options: consistent)' ,
110121 } ,
111122 {
112123 code : getTestCases ( [
113124 '{ code: "foo" }' ,
114125 '{ code: "bar", options: ["foo"] }' ,
115126 ] ) ,
116127 options : [ 'consistent' ] ,
128+ name : 'multiple objects with options (options: consistent)' ,
117129 } ,
118130 {
119131 code : getTestCases ( [ '"foo"' , "'bar'" , '`baz`' ] ) ,
120132 options : [ 'consistent' ] ,
133+ name : 'multiple types of strings (options: consistent)' ,
121134 } ,
122135
123136 // consistent-as-needed
124137 {
125138 code : getTestCases ( [ '"foo"' , '"bar"' ] ) ,
126139 options : [ 'consistent-as-needed' ] ,
140+ name : 'multiple strings (options: consistent-as-needed)' ,
127141 } ,
128142 {
129143 code : getTestCases ( [
130144 '{ code: "foo" }' ,
131145 '{ code: "bar", options: ["foo"] }' ,
132146 ] ) ,
133147 options : [ 'consistent-as-needed' ] ,
148+ name : 'multiple objects (options: consistent-as-needed)' ,
134149 } ,
135150 {
136151 code : getTestCases ( [ '"foo"' , "'bar'" , '`baz`' ] ) ,
137152 options : [ 'consistent-as-needed' ] ,
153+ name : 'multiple types of strings (options: consistent-as-needed)' ,
138154 } ,
139155 `
140156 new NotRuleTester().run('foo', bar, {
@@ -177,24 +193,28 @@ ruleTester.run('test-case-shorthand-strings', rule, {
177193 output : getTestCases ( [ '{code: "foo"}' ] ) ,
178194 options : [ 'never' ] ,
179195 errors : [ UNEXPECTED_SHORTHAND_ERROR ] ,
196+ name : 'string (options: never)' ,
180197 } ,
181198 {
182199 code : getTestCases ( [ 'foo' , '"bar"' ] ) ,
183200 output : getTestCases ( [ 'foo' , '{code: "bar"}' ] ) ,
184201 options : [ 'never' ] ,
185202 errors : [ UNEXPECTED_SHORTHAND_ERROR ] ,
203+ name : 'multiple strings (options: never)' ,
186204 } ,
187205 {
188206 code : getTestCases ( [ '`foo`' ] ) ,
189207 output : getTestCases ( [ '{code: `foo`}' ] ) ,
190208 options : [ 'never' ] ,
191209 errors : [ UNEXPECTED_SHORTHAND_ERROR ] ,
210+ name : 'template string (options: never)' ,
192211 } ,
193212 {
194213 code : getTestCases ( [ '"foo"' ] ) + getTestCases ( [ '"foo"' ] ) ,
195214 output : getTestCases ( [ '{code: "foo"}' ] ) + getTestCases ( [ '{code: "foo"}' ] ) ,
196215 options : [ 'never' ] ,
197216 errors : [ UNEXPECTED_SHORTHAND_ERROR , UNEXPECTED_SHORTHAND_ERROR ] ,
217+ name : 'multiple ruletester calls with strings (options: never)' ,
198218 } ,
199219
200220 // consistent
@@ -215,6 +235,7 @@ ruleTester.run('test-case-shorthand-strings', rule, {
215235 output : getTestCases ( [ '"foo"' , '"bar"' ] ) ,
216236 options : [ 'consistent-as-needed' ] ,
217237 errors : [ EXPECTED_SHORTHAND_ERROR , EXPECTED_SHORTHAND_ERROR ] ,
238+ name : 'multiple objects (options: consistent-as-needed)' ,
218239 } ,
219240 {
220241 code : getTestCases ( [
@@ -229,6 +250,7 @@ ruleTester.run('test-case-shorthand-strings', rule, {
229250 ] ) ,
230251 options : [ 'consistent-as-needed' ] ,
231252 errors : [ UNEXPECTED_SHORTHAND_ERROR , UNEXPECTED_SHORTHAND_ERROR ] ,
253+ name : 'multiple strings and object (options: consistent-as-needed)' ,
232254 } ,
233255 {
234256 code : getTestCases ( [
@@ -243,6 +265,7 @@ ruleTester.run('test-case-shorthand-strings', rule, {
243265 ] ) ,
244266 options : [ 'consistent-as-needed' ] ,
245267 errors : [ UNEXPECTED_SHORTHAND_ERROR , UNEXPECTED_SHORTHAND_ERROR ] ,
268+ name : 'multiple strings and object in between (options: consistent-as-needed)' ,
246269 } ,
247270 ] ,
248271} ) ;
0 commit comments