Skip to content

Commit

Permalink
Test addition of custom message for valid-test-description rule
Browse files Browse the repository at this point in the history
  • Loading branch information
BourgoisMickael committed Aug 21, 2019
1 parent f1b711d commit 6593dc4
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/rules/valid-test-description.js
Expand Up @@ -31,6 +31,22 @@ ruleTester.run('valid-test-description', rules['valid-test-description'], {
options: [ '^should', [ 'someFunction' ] ],
code: 'someFunction("should do something", function () { });'
},
{
options: [ '^should', [ 'someFunction' ], 'some error message' ],
code: 'someFunction("should do something", function () { });'
},
{
options: [ /^should/, [ 'someFunction' ], 'some error message' ],
code: 'someFunction("should do something", function () { });'
},
{
options: [ { pattern: '^should', testNames: [ 'someFunction' ], message: 'some error message' } ],
code: 'someFunction("should do something", function () { });'
},
{
options: [ { pattern: /^should/, testNames: [ 'someFunction' ], message: 'some error message' } ],
code: 'someFunction("should do something", function () { });'
},
'someOtherFunction();',
{
parserOptions: { ecmaVersion: 2017 },
Expand Down Expand Up @@ -84,6 +100,27 @@ ruleTester.run('valid-test-description', rules['valid-test-description'], {
errors: [
{ message: 'Invalid "customFunction()" description found.' }
]
},
{
options: [ 'required', [ 'customFunction' ], 'some error message' ],
code: 'customFunction("this is a test", function () { });',
errors: [
{ message: 'some error message' }
]
},
{
options: [ { pattern: 'required', testNames: [ 'customFunction' ], message: 'some error message' } ],
code: 'customFunction("this is a test", function () { });',
errors: [
{ message: 'some error message' }
]
},
{
options: [ {} ],
code: 'it("this is a test", function () { });',
errors: [
{ message: 'Invalid "it()" description found.' }
]
}
]
});

0 comments on commit 6593dc4

Please sign in to comment.