You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
939 B
35 lines
939 B
4 years ago
|
const testBoilerplate = (name, author, description) => `/* eslint-env jest */
|
||
|
/**
|
||
|
* @fileoverview ${description}
|
||
|
* @author ${author}
|
||
|
*/
|
||
|
|
||
|
// -----------------------------------------------------------------------------
|
||
|
// Requirements
|
||
|
// -----------------------------------------------------------------------------
|
||
|
|
||
|
import { RuleTester } from 'eslint';
|
||
|
import parserOptionsMapper from '../../__util__/parserOptionsMapper';
|
||
|
import rule from '../../../src/rules/${name}';
|
||
|
|
||
|
// -----------------------------------------------------------------------------
|
||
|
// Tests
|
||
|
// -----------------------------------------------------------------------------
|
||
|
|
||
|
const ruleTester = new RuleTester();
|
||
|
|
||
|
const expectedError = {
|
||
|
message: '',
|
||
|
type: 'JSXOpeningElement',
|
||
|
};
|
||
|
|
||
|
ruleTester.run('${name}', rule, {
|
||
|
valid: [
|
||
|
{ code: '<div />;' },
|
||
|
].map(parserOptionsMapper),
|
||
|
invalid: [].map(parserOptionsMapper),
|
||
|
});
|
||
|
`;
|
||
|
|
||
|
module.exports = testBoilerplate;
|