Skip to content

Commit

Permalink
Add more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlademann-wf committed Apr 10, 2024
1 parent f529715 commit 8078dbc
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,28 @@ void main() {
'''));
});

test(
'unless the single condition is not a null check of the function being called',
() async {
await testSuggestor(
expectedPatchCount: 0,
input: withOverReactImport('''
final Foo = uiFunction<UiProps>(
(props) {
final handleClick = useCallback<MouseEventCallback>((e) {
if (1 > 0) {
props.onClick(e);
}
}, [props.onClick]);
return (Dom.button()..onClick = handleClick)();
},
UiFactoryConfig(displayName: 'Foo'),
);
'''),
);
});

test('unless there are multiple conditions', () async {
await testSuggestor(
expectedPatchCount: 0,
Expand Down Expand Up @@ -119,6 +141,26 @@ void main() {
'''));
});

test(
'unless the single condition is not a null check of the function being called',
() async {
await testSuggestor(
expectedPatchCount: 0,
input: withOverReactImport('''
final Foo = uiFunction<UiProps>(
(props) {
final handleClick = useCallback<MouseEventCallback>((e) {
1 > 0 && props.onClick(e);
}, [props.onClick]);
return (Dom.button()..onClick = handleClick)();
},
UiFactoryConfig(displayName: 'Foo'),
);
'''),
);
});

test('unless there are multiple conditions', () async {
await testSuggestor(
expectedPatchCount: 0,
Expand Down

0 comments on commit 8078dbc

Please sign in to comment.