katoikia-app/web-ui/web-react/node_modules/eslint-plugin-jsx-a11y/scripts/boilerplate/test.js

35 lines
939 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
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;