File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,18 @@ const validNonStrictTestCases: RuleValidTestCase[] = [
7878 })
7979 ` ,
8080 } ,
81+ {
82+ code : `// case: RTL act wrapping optional chaining call without RTL usage
83+ import { act, render } from '@testing-library/react'
84+
85+ test('valid case', async () => {
86+ act(() => {
87+ render(element);
88+ callback?.();
89+ });
90+ });
91+ ` ,
92+ } ,
8193] ;
8294
8395const validTestCases : RuleValidTestCase [ ] = [
@@ -140,6 +152,19 @@ const validTestCases: RuleValidTestCase[] = [
140152 act(() => stuffThatDoesNotUseRTL()).then(() => {})
141153 act(stuffThatDoesNotUseRTL().then(() => {}))
142154 });
155+ ` ,
156+ } ) ) ,
157+ ...SUPPORTED_TESTING_FRAMEWORKS . map ( ( [ testingFramework , shortName ] ) => ( {
158+ code : `// case: ${ shortName } act wrapping non-${ shortName } calls
159+ import { act } from '${ testingFramework } '
160+
161+ let callback: undefined | (() => void);
162+
163+ test('valid case', async () => {
164+ act(() => {
165+ callback?.();
166+ });
167+ });
143168 ` ,
144169 } ) ) ,
145170 {
You can’t perform that action at this time.
0 commit comments