Skip to content

Commit

Permalink
Testing: Global function checking
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Dec 31, 2019
1 parent 2cdbc02 commit 95533cc
Show file tree
Hide file tree
Showing 5 changed files with 430 additions and 0 deletions.
84 changes: 84 additions & 0 deletions test/rules/assertions/requireParamDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,59 @@ export default {
},
],
},
{
code: `
/**
* @param foo
*/
function quux (foo) {
}
`,
errors: [
{
line: 3,
message: 'Missing JSDoc @param "foo" description.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @function
* @param foo
*/
`,
errors: [
{
line: 4,
message: 'Missing JSDoc @param "foo" description.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @callback
* @param foo
*/
`,
errors: [
{
line: 4,
message: 'Missing JSDoc @param "foo" description.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
Expand Down Expand Up @@ -84,5 +137,36 @@ export default {
}
`,
},
{
code: `
/**
* @param foo Foo.
*/
function quux (foo) {
}
`,
options: [
{
contexts: ['any'],
},
],
},
{
code: `
/**
* @function
* @param foo
*/
`,
},
{
code: `
/**
* @callback
* @param foo
*/
`,
},
],
};
84 changes: 84 additions & 0 deletions test/rules/assertions/requireParamName.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,59 @@ export default {
},
],
},
{
code: `
/**
* @param {string}
*/
function quux (foo) {
}
`,
errors: [
{
line: 3,
message: 'There must be an identifier after @param tag.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @function
* @param {string}
*/
`,
errors: [
{
line: 4,
message: 'There must be an identifier after @param tag.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @callback
* @param {string}
*/
`,
errors: [
{
line: 4,
message: 'There must be an identifier after @param tag.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
Expand Down Expand Up @@ -67,6 +120,21 @@ export default {
}
`,
},
{
code: `
/**
* @param foo
*/
function quux (foo) {
}
`,
options: [
{
contexts: ['any'],
},
],
},
{
code: `
/**
Expand All @@ -77,5 +145,21 @@ export default {
}
`,
},
{
code: `
/**
* @function
* @param
*/
`,
},
{
code: `
/**
* @callback
* @param
*/
`,
},
],
};
82 changes: 82 additions & 0 deletions test/rules/assertions/requireParamType.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,59 @@ export default {
},
],
},
{
code: `
/**
* @param foo
*/
function quux (foo) {
}
`,
errors: [
{
line: 3,
message: 'Missing JSDoc @param "foo" type.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @function
* @param foo
*/
`,
errors: [
{
line: 4,
message: 'Missing JSDoc @param "foo" type.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @callback
* @param foo
*/
`,
errors: [
{
line: 4,
message: 'Missing JSDoc @param "foo" type.',
},
],
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
Expand Down Expand Up @@ -84,5 +137,34 @@ export default {
}
`,
},
{
code: `
/**
* @param {number} foo
*/
function quux (foo) {
}
`,
options: [{
contexts: ['any'],
}],
},
{
code: `
/**
* @function
* @param foo
*/
`,
},
{
code: `
/**
* @callback
* @param foo
*/
`,
},
],
};

0 comments on commit 95533cc

Please sign in to comment.