Skip to content

Commit

Permalink
Fix flaky test using mockito by using provideDummy. (#1319)
Browse files Browse the repository at this point in the history
This test was failing when using #1318 with the `
--test-randomize-ordering-seed 1`.

Required for #1318 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Updated the setup for `Past Calendrical Events Page` tests to use a
dummy implementation for state testing due to limitations with mocking
frameworks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Jonas-Sander authored Feb 27, 2024
1 parent de1193b commit e8a58d0
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,15 @@ void main() {

group('without Sharezone Plus', () {
setUp(() {
when(controller.state).thenReturn(
const PastCalendricalEventsPageNotUnlockedState(
sortingOrder: EventsSortingOrder.descending,
),
const state = PastCalendricalEventsPageNotUnlockedState(
sortingOrder: EventsSortingOrder.descending,
);
// Mockito does not support mocking sealed classes yet, so we have to
// provide a dummy implementation of the state.
//
// Ticket: https://github.com/dart-lang/mockito/issues/675
provideDummy<PastCalendricalEventsPageState>(state);
when(controller.state).thenReturn(state);
});

testGoldens('renders correctly (light theme)', (tester) async {
Expand Down

0 comments on commit e8a58d0

Please sign in to comment.