Skip to content

Commit f309906

Browse files
committed
Add invalid test cases for generic types
1 parent 2abae25 commit f309906

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/rules/assertions/noUndefinedTypes.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,51 @@ export default {
101101
}
102102
}
103103
}
104+
},
105+
{
106+
code: `
107+
class Foo {
108+
/**
109+
* @return {TEMPLATE_TYPE}
110+
*/
111+
bar () {
112+
}
113+
}
114+
`,
115+
errors: [
116+
{
117+
line: 4,
118+
message: 'The type \'TEMPLATE_TYPE\' is undefined.'
119+
}
120+
]
121+
},
122+
{
123+
code: `
124+
class Foo {
125+
/**
126+
* @return {TEMPLATE_TYPE}
127+
*/
128+
invalidTemplateReference () {
129+
}
130+
}
131+
132+
/**
133+
* @template TEMPLATE_TYPE
134+
*/
135+
class Bar {
136+
/**
137+
* @return {TEMPLATE_TYPE}
138+
*/
139+
validTemplateReference () {
140+
}
141+
}
142+
`,
143+
errors: [
144+
{
145+
line: 4,
146+
message: 'The type \'TEMPLATE_TYPE\' is undefined.'
147+
}
148+
]
104149
}
105150
],
106151
valid: [

0 commit comments

Comments
 (0)