Open gaganyadav80 opened 1 year ago
class Listener<T> extends Mock { void call(T? previous, T next); } void main() { ProviderContainer makeProviderContainer() { final ProviderContainer container = ProviderContainer( overrides: <Override>[ secureStorageServiceProvider.overrideWithValue(mockSecureStorage), activeSessionsRepositoryProvider.overrideWithValue(mockActiveSessionsRepository), ], ); addTearDown(container.dispose); return container; } test( 'Fetch all active sessions', () async { final ProviderContainer container = makeProviderContainer(); final Listener<ActiveSessionsState> listener = Listener<ActiveSessionsState>(); container.listen( activeSessionsNotifer, listener, fireImmediately: true, ); verify(() => listener(const ActiveSessionsInitialState(), const ActiveSessionsLoadingState())); }, ); }
The verify call is giving me the below error and I believe it is because the use of Listener class.
verify
Listener
Used on a non-mockito object package:test_api fail _makeVerify.<fn> main.<fn>
Ran into this today as well @bizz84 . Any idea what is wrong with the tests here?
Edit: In my case it was because I was using Mockito rather than Mocktail.
The
verify
call is giving me the below error and I believe it is because the use ofListener
class.