@@ -256,6 +275,44 @@ ruleTester.run(RULE_NAME, rule, {
code: `
import React from 'react';
+ const TestComponent = props => {
+ return (
+
+ Hello
+
+ )
+ };
+ `,
+ options: [
+ {
+ testIdPattern: '^right$',
+ testIdAttribute: ['custom-attr', 'another-custom-attr'],
+ },
+ ],
+ filename: '/my/cool/__tests__/Parent/index.js',
+ errors: [
+ {
+ messageId: 'invalidTestId',
+ data: {
+ attr: 'custom-attr',
+ value: 'wrong',
+ regex: '/^right$/',
+ },
+ },
+ {
+ messageId: 'invalidTestId',
+ data: {
+ attr: 'another-custom-attr',
+ value: 'wrong',
+ regex: '/^right$/',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+ import React from 'react';
+
const TestComponent = props => {
return (