Skip to content

Commit 79d8967

Browse files
authored
test(no-node-access): add extra valid test case (#684)
These examples were gotten from discussions in issue #386
1 parent e31fe03 commit 79d8967

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/lib/rules/no-node-access.test.ts

+19
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,25 @@ ruleTester.run(RULE_NAME, rule, {
138138
expect(container.firstChild).toMatchSnapshot()
139139
`,
140140
},
141+
{
142+
// Example from discussions in issue #386
143+
code: `
144+
import { render } from '@testing-library/react';
145+
146+
function Wrapper({ children }) {
147+
// this should NOT be reported
148+
if (children) {
149+
// ...
150+
}
151+
152+
// this should NOT be reported
153+
return <div className="wrapper-class">{children}</div>
154+
};
155+
156+
render(<Wrapper><SomeComponent /></Wrapper>);
157+
expect(screen.getByText('SomeComponent')).toBeInTheDocument();
158+
`,
159+
},
141160
]
142161
),
143162
invalid: SUPPORTED_TESTING_FRAMEWORKS.flatMap((testingFramework) => [

0 commit comments

Comments
 (0)