@@ -146,7 +146,7 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
146146 } ,
147147 errors : [
148148 {
149- message : 'parameters xxx and yyy are out of order' ,
149+ message : 'Parameters xxx and yyy are out of order' ,
150150 column : 10 ,
151151 line : 2 ,
152152 rule : "jsDoc" ,
@@ -168,14 +168,14 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
168168 } ,
169169 errors : [
170170 {
171- message : 'parameters xxx and zzz are out of order' ,
171+ message : 'Parameters xxx and zzz are out of order' ,
172172 column : 14 ,
173173 line : 3 ,
174174 rule : "jsDoc" ,
175175 filename : "input"
176176 } ,
177177 {
178- message : 'parameters yyy and xxx are out of order' ,
178+ message : 'Parameters yyy and xxx are out of order' ,
179179 column : 14 ,
180180 line : 4 ,
181181 rule : "jsDoc" ,
@@ -195,8 +195,8 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
195195 } ;
196196 } ,
197197 errors : [
198- { message : 'parameter xxx is out of order' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
199- { message : 'expected xxx but got yyy' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
198+ { message : 'Parameter xxx is out of order' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
199+ { message : 'Expected xxx but got yyy' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
200200 ]
201201 } , {
202202 it : 'should report out of order and expected v2' ,
@@ -211,8 +211,8 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
211211 } ;
212212 } ,
213213 errors : [
214- { message : 'expected yyy but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
215- { message : 'parameter yyy is out of order' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
214+ { message : 'Expected yyy but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
215+ { message : 'Parameter yyy is out of order' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
216216 ]
217217 } , {
218218 it : 'should not report out of order but expected' ,
@@ -227,10 +227,27 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
227227 } ;
228228 } ,
229229 errors : [
230- { message : 'expected zzz but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" }
230+ { message : 'Expected zzz but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" }
231231 ]
232-
233232 } , {
233+ it : 'should not report wrong order' ,
234+ code : function ( ) {
235+ /**
236+ * @param {string|Array.<string> } types
237+ * @param {function(this: DocComment, DocTag): DocComment } fn
238+ */
239+ function iterateByTypes ( types , fn ) { }
240+ }
241+ }
242+ // jscs:enable
243+ /* jshint ignore:end */
244+ ] ) ;
245+
246+ // ticked and chevroned param names
247+ checker . cases ( [
248+ /* jshint ignore:start */
249+ /* jscs:disable */
250+ {
234251 it : 'should not report simple ticked param' ,
235252 code : function ( ) {
236253 /**
@@ -256,7 +273,16 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
256273 */
257274 function methodThree ( required , optional ) { }
258275 }
259- } , {
276+ }
277+ // jscs:enable
278+ /* jshint ignore:end */
279+ ] ) ;
280+
281+ // dotted param names
282+ checker . cases ( [
283+ /* jshint ignore:start */
284+ /* jscs:disable */
285+ {
260286 it : 'should not report dotted param names' ,
261287 code : function ( ) {
262288 /**
@@ -270,14 +296,50 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
270296 function yeah ( mod , props , staticProps ) { }
271297 }
272298 } , {
273- it : 'should not report wrong order ' ,
299+ it : 'should report inconsistency of separated dotted params ' ,
274300 code : function ( ) {
275301 /**
276- * @param {string|Array.<string> } types
277- * @param {function(this: DocComment, DocTag): DocComment } fn
302+ * @param {Object } options
303+ * @param {String } definetelyNotOptions.cdir
304+ * @param {Boolean } otherOptions.noLog
278305 */
279- function iterateByTypes ( types , fn ) { }
280- }
306+ module . exports . createMiddleware = function ( options ) { /* ... */ } ;
307+ } ,
308+ errors : [
309+ {
310+ "column" : 19 ,
311+ "filename" : "input" ,
312+ "line" : 3 ,
313+ "message" : "Expected `options` but got `definetelyNotOptions`" ,
314+ "rule" : "jsDoc"
315+ } ,
316+ {
317+ "column" : 20 ,
318+ "filename" : "input" ,
319+ "line" : 4 ,
320+ "message" : "Expected `options` but got `otherOptions`" ,
321+ "rule" : "jsDoc"
322+ }
323+ ]
324+ } , {
325+ it : 'should report unjoined params' ,
326+ code : function ( ) {
327+ /**
328+ * @param {String } options.cdir
329+ */
330+ module . exports . createMiddleware = function ( ) { /* ... */ } ;
331+ } ,
332+ errors : { "message" : "Inconsistent param found" }
333+ } , {
334+ it : 'should not report params' ,
335+ code : function ( ) {
336+ /**
337+ * @param {Object } options
338+ * @param {String } options.cdir
339+ */
340+ module . exports . createMiddleware = function ( ) { /* ... */ } ;
341+ } ,
342+ errors : [ ]
281343 }
282344 /* jscs: enable */
283345 /* jshint ignore:end */
0 commit comments