Skip to content

Commit 588d40f

Browse files
committed
testing: add cases for ClassExpression, ObjectExpression and for a type that is handled by the new default behavior (typescript interface)
1 parent 3e3aae5 commit 588d40f

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

test/rules/assertions/requireDescription.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,74 @@ export default {
9090
message: 'Missing JSDoc @description description.'
9191
}
9292
]
93+
},
94+
{
95+
code: `
96+
/**
97+
*
98+
*/
99+
interface quux {
100+
101+
}
102+
`,
103+
errors: [
104+
{
105+
message: 'Missing JSDoc @description declaration.'
106+
}
107+
],
108+
options: [
109+
{
110+
contexts: [
111+
'TSInterfaceDeclaration'
112+
],
113+
noDefaults: true
114+
}
115+
],
116+
parser: require.resolve('@typescript-eslint/parser')
117+
},
118+
{
119+
code: `
120+
/**
121+
*
122+
*/
123+
var quux = class {
124+
125+
};
126+
`,
127+
errors: [
128+
{
129+
message: 'Missing JSDoc @description declaration.'
130+
}
131+
],
132+
options: [
133+
{
134+
contexts: [
135+
'ClassExpression'
136+
]
137+
}
138+
]
139+
},
140+
{
141+
code: `
142+
/**
143+
*
144+
*/
145+
var quux = {
146+
147+
};
148+
`,
149+
errors: [
150+
{
151+
message: 'Missing JSDoc @description declaration.'
152+
}
153+
],
154+
options: [
155+
{
156+
contexts: [
157+
'ObjectExpression'
158+
]
159+
}
160+
]
93161
}
94162
],
95163
valid: [
@@ -168,6 +236,37 @@ export default {
168236
exemptedBy: ['type']
169237
}
170238
]
239+
},
240+
{
241+
code: `
242+
/**
243+
*
244+
*/
245+
interface quux {
246+
247+
}
248+
`,
249+
parser: require.resolve('@typescript-eslint/parser')
250+
},
251+
{
252+
code: `
253+
/**
254+
*
255+
*/
256+
var quux = class {
257+
258+
};
259+
`
260+
},
261+
{
262+
code: `
263+
/**
264+
*
265+
*/
266+
var quux = {
267+
268+
};
269+
`
171270
}
172271
]
173272
};

0 commit comments

Comments
 (0)