Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FED-1881 Fix regression in SyntheticEvent mock class type-checking #381

Merged
merged 3 commits into from
Nov 9, 2023

Conversation

greglittlefield-wf
Copy link
Collaborator

@greglittlefield-wf greglittlefield-wf commented Nov 9, 2023

Motivation

When testing these changes, we ran into a case where a consumer was mocking type, and relying on type-checking utilities to respect that.

class MockSyntheticEvent extends Mock implements SyntheticEvent {}
final mockEvent = MockSyntheticEvent();
when(mockEvent.type).then('click');
print(mockEvent.isMouseEvent);

Previously, this would print true, but in v7_wip, it prints false.

Solution

  • Update event type checking to match old behavior.
  • Add regression test and additional test

Testing

@aviary2-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@greglittlefield-wf greglittlefield-wf marked this pull request as ready for review November 9, 2023 22:17
} catch (_) {}

return type != null && types.any(type.contains);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the current implementation in master:

bool _checkEventType(List<String> types) => this != null && type != null && types.any((t) => type.contains(t));

@robbecker-wf
Copy link
Member

QA+1 CI passes with updated/new tests that cover the functionality

@rmconsole-wf rmconsole-wf changed the title Fix regression in SyntheticEvent mock class type-checking FED-1881 Fix regression in SyntheticEvent mock class type-checking Nov 9, 2023
@greglittlefield-wf
Copy link
Collaborator Author

@Workiva/release-management-p

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from RM

@rmconsole2-wf rmconsole2-wf merged commit b27803c into v7_wip Nov 9, 2023
6 checks passed
@rmconsole2-wf rmconsole2-wf deleted the fix-mocked-event-types branch November 9, 2023 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants