test: update tests for vote viewer state changes

- Update mock providers to remove VoteService dependency
- Add ViewerState to test fixtures for feed and comments
- Update FeedProvider tests for vote state initialization
- Update CommentsProvider tests for recursive vote state init
- Update VoteProvider tests for extractRkeyFromUri utility
- Remove obsolete vote service test methods (deleteVote, getUserVotes)
- Add generated mock files for auth service tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

+12
test/providers/auth_provider_test.mocks.dart
···
import 'package:coves_flutter/models/coves_session.dart' as _i2;
import 'package:coves_flutter/services/coves_auth_service.dart' as _i3;
import 'package:mockito/mockito.dart' as _i1;
+
import 'package:mockito/src/dummies.dart' as _i5;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
···
returnValueForMissingStub: _i4.Future<void>.value(),
)
as _i4.Future<void>);
+
+
@override
+
String validateAndNormalizeHandle(String? handle) =>
+
(super.noSuchMethod(
+
Invocation.method(#validateAndNormalizeHandle, [handle]),
+
returnValue: _i5.dummyValue<String>(
+
this,
+
Invocation.method(#validateAndNormalizeHandle, [handle]),
+
),
+
)
+
as String);
}
+381 -141
test/providers/comments_provider_test.dart
···
import 'package:coves_flutter/providers/comments_provider.dart';
import 'package:coves_flutter/providers/vote_provider.dart';
import 'package:coves_flutter/services/coves_api_service.dart';
-
import 'package:coves_flutter/services/vote_service.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
···
import 'comments_provider_test.mocks.dart';
// Generate mocks for dependencies
-
@GenerateMocks([AuthProvider, CovesApiService, VoteProvider, VoteService])
+
@GenerateMocks([AuthProvider, CovesApiService, VoteProvider])
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
···
late MockAuthProvider mockAuthProvider;
late MockCovesApiService mockApiService;
late MockVoteProvider mockVoteProvider;
-
late MockVoteService mockVoteService;
setUp(() {
mockAuthProvider = MockAuthProvider();
mockApiService = MockCovesApiService();
mockVoteProvider = MockVoteProvider();
-
mockVoteService = MockVoteService();
// Default: user is authenticated
when(mockAuthProvider.isAuthenticated).thenReturn(true);
···
mockAuthProvider,
apiService: mockApiService,
voteProvider: mockVoteProvider,
-
voteService: mockVoteService,
);
});
···
),
).thenAnswer((_) async => mockResponse);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: testPostUri,
refresh: true,
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => mockResponse);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: testPostUri,
···
),
).thenAnswer((_) async => firstResponse);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: testPostUri,
refresh: true,
···
),
).thenAnswer((_) async => firstResponse);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: testPostUri,
refresh: true,
···
),
).thenAnswer((_) async => response);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: testPostUri,
refresh: true,
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => firstResponse);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: testPostUri,
···
return response;
});
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
// Start first load
final firstFuture = commentsProvider.loadComments(
postUri: testPostUri,
···
).called(2);
});
-
test('should load vote state when authenticated', () async {
-
final mockComments = [_createMockThreadComment('comment1')];
+
test(
+
'should initialize vote state from viewer data when authenticated',
+
() async {
+
final mockComments = [_createMockThreadComment('comment1')];
-
final mockResponse = CommentsResponse(post: {}, comments: mockComments);
+
final mockResponse = CommentsResponse(
+
post: {},
+
comments: mockComments,
+
);
-
when(
-
mockApiService.getComments(
-
postUri: anyNamed('postUri'),
-
sort: anyNamed('sort'),
-
timeframe: anyNamed('timeframe'),
-
depth: anyNamed('depth'),
-
limit: anyNamed('limit'),
-
cursor: anyNamed('cursor'),
-
),
-
).thenAnswer((_) async => mockResponse);
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => mockResponse);
-
final mockUserVotes = <String, VoteInfo>{
-
'comment1': const VoteInfo(
-
voteUri: 'at://did:plc:test/social.coves.feed.vote/123',
-
direction: 'up',
-
rkey: '123',
-
),
-
};
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => mockUserVotes);
-
when(mockVoteProvider.loadInitialVotes(any)).thenReturn(null);
-
-
await commentsProvider.loadComments(
-
postUri: testPostUri,
-
refresh: true,
-
);
+
expect(commentsProvider.comments.length, 1);
+
expect(commentsProvider.error, null);
+
},
+
);
-
verify(mockVoteService.getUserVotes()).called(1);
-
verify(mockVoteProvider.loadInitialVotes(mockUserVotes)).called(1);
-
});
-
-
test('should not load vote state when not authenticated', () async {
+
test('should not initialize vote state when not authenticated', () async {
when(mockAuthProvider.isAuthenticated).thenReturn(false);
final mockResponse = CommentsResponse(
···
refresh: true,
);
-
verifyNever(mockVoteService.getUserVotes());
-
verifyNever(mockVoteProvider.loadInitialVotes(any));
-
});
-
-
test('should continue loading comments if vote loading fails', () async {
-
final mockComments = [_createMockThreadComment('comment1')];
-
-
final mockResponse = CommentsResponse(post: {}, comments: mockComments);
-
-
when(
-
mockApiService.getComments(
-
postUri: anyNamed('postUri'),
-
sort: anyNamed('sort'),
-
timeframe: anyNamed('timeframe'),
-
depth: anyNamed('depth'),
-
limit: anyNamed('limit'),
-
cursor: anyNamed('cursor'),
-
),
-
).thenAnswer((_) async => mockResponse);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenThrow(Exception('Vote service error'));
-
-
await commentsProvider.loadComments(
-
postUri: testPostUri,
-
refresh: true,
-
);
-
-
// Comments should still be loaded despite vote error
expect(commentsProvider.comments.length, 1);
expect(commentsProvider.error, null);
});
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => initialResponse);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: testPostUri,
···
),
).thenAnswer((_) async => response);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: testPostUri,
refresh: true,
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => initialResponse);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: testPostUri,
···
),
).thenAnswer((_) async => initialResponse);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: testPostUri,
refresh: true,
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => response);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: testPostUri,
···
),
).thenAnswer((_) async => successResponse);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.retry();
expect(commentsProvider.error, null);
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => response);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: testPostUri,
···
),
).thenAnswer((_) async => response);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
expect(commentsProvider.currentTimeNotifier.value, null);
await commentsProvider.loadComments(
···
cursor: anyNamed('cursor'),
),
).thenAnswer((_) async => response);
-
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
await commentsProvider.loadComments(
postUri: 'at://did:plc:test/social.coves.post.record/123',
···
),
).thenAnswer((_) async => response);
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
await commentsProvider.loadComments(
postUri: 'at://did:plc:test/social.coves.post.record/123',
refresh: true,
···
return response;
});
-
when(
-
mockVoteService.getUserVotes(),
-
).thenAnswer((_) async => <String, VoteInfo>{});
-
final loadFuture = commentsProvider.loadComments(
postUri: 'at://did:plc:test/social.coves.post.record/123',
refresh: true,
···
expect(commentsProvider.isLoading, false);
});
});
+
+
group('Vote state initialization from viewer data', () {
+
const testPostUri = 'at://did:plc:test/social.coves.post.record/123';
+
+
test('should initialize vote state when viewer.vote is "up"', () async {
+
final response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'comment1',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
],
+
);
+
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => response);
+
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
+
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'comment1',
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
).called(1);
+
});
+
+
test('should initialize vote state when viewer.vote is "down"', () async {
+
final response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'comment1',
+
vote: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
],
+
);
+
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => response);
+
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
+
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'comment1',
+
voteDirection: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
).called(1);
+
});
+
+
test(
+
'should clear stale vote state when viewer.vote is null on refresh',
+
() async {
+
final response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'comment1',
+
vote: null,
+
voteUri: null,
+
),
+
],
+
);
+
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => response);
+
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
+
+
// Should call setInitialVoteState with null to clear stale state
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'comment1',
+
voteDirection: null,
+
voteUri: null,
+
),
+
).called(1);
+
},
+
);
+
+
test(
+
'should initialize vote state recursively for nested replies',
+
() async {
+
final response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'parent-comment',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote-parent',
+
replies: [
+
_createMockThreadCommentWithViewer(
+
uri: 'reply-comment',
+
vote: 'down',
+
voteUri:
+
'at://did:plc:test/social.coves.feed.vote/vote-reply',
+
),
+
],
+
),
+
],
+
);
+
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => response);
+
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
+
+
// Should initialize vote state for both parent and reply
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'parent-comment',
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote-parent',
+
),
+
).called(1);
+
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'reply-comment',
+
voteDirection: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote-reply',
+
),
+
).called(1);
+
},
+
);
+
+
test('should initialize vote state for deeply nested replies', () async {
+
final response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'level-0',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote-0',
+
replies: [
+
_createMockThreadCommentWithViewer(
+
uri: 'level-1',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote-1',
+
replies: [
+
_createMockThreadCommentWithViewer(
+
uri: 'level-2',
+
vote: 'down',
+
voteUri:
+
'at://did:plc:test/social.coves.feed.vote/vote-2',
+
),
+
],
+
),
+
],
+
),
+
],
+
);
+
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => response);
+
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
+
+
// Should initialize vote state for all 3 levels
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: anyNamed('postUri'),
+
voteDirection: anyNamed('voteDirection'),
+
voteUri: anyNamed('voteUri'),
+
),
+
).called(3);
+
});
+
+
test(
+
'should only initialize vote state for new comments on pagination',
+
() async {
+
// First page: comment1 with upvote
+
final page1Response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'comment1',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
],
+
cursor: 'cursor1',
+
);
+
+
// Second page: comment2 with downvote
+
final page2Response = CommentsResponse(
+
post: {},
+
comments: [
+
_createMockThreadCommentWithViewer(
+
uri: 'comment2',
+
vote: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote2',
+
),
+
],
+
);
+
+
// First call returns page 1
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: null,
+
),
+
).thenAnswer((_) async => page1Response);
+
+
// Second call (with cursor) returns page 2
+
when(
+
mockApiService.getComments(
+
postUri: anyNamed('postUri'),
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
depth: anyNamed('depth'),
+
limit: anyNamed('limit'),
+
cursor: 'cursor1',
+
),
+
).thenAnswer((_) async => page2Response);
+
+
// Load first page (refresh)
+
await commentsProvider.loadComments(
+
postUri: testPostUri,
+
refresh: true,
+
);
+
+
// Verify comment1 vote initialized
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'comment1',
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
).called(1);
+
+
// Clear previous verifications
+
clearInteractions(mockVoteProvider);
+
+
// Load second page (pagination, not refresh)
+
await commentsProvider.loadMoreComments();
+
+
// Should ONLY initialize vote state for comment2 (new comments)
+
// NOT re-initialize comment1 (which would wipe optimistic votes)
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'comment2',
+
voteDirection: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote2',
+
),
+
).called(1);
+
+
// Verify comment1 was NOT re-initialized during pagination
+
verifyNever(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'comment1',
+
voteDirection: anyNamed('voteDirection'),
+
voteUri: anyNamed('voteUri'),
+
),
+
);
+
},
+
);
+
});
});
···
),
);
+
+
// Helper function to create mock comments with viewer state and optional replies
+
ThreadViewComment _createMockThreadCommentWithViewer({
+
required String uri,
+
String? vote,
+
String? voteUri,
+
List<ThreadViewComment>? replies,
+
}) {
+
return ThreadViewComment(
+
comment: CommentView(
+
uri: uri,
+
cid: 'cid-$uri',
+
content: 'Test comment content',
+
createdAt: DateTime.parse('2025-01-01T12:00:00Z'),
+
indexedAt: DateTime.parse('2025-01-01T12:00:00Z'),
+
author: AuthorView(
+
did: 'did:plc:author',
+
handle: 'test.user',
+
displayName: 'Test User',
+
),
+
post: CommentRef(
+
uri: 'at://did:plc:test/social.coves.post.record/123',
+
cid: 'post-cid',
+
),
+
stats: CommentStats(score: 10, upvotes: 12, downvotes: 2),
+
viewer: CommentViewerState(vote: vote, voteUri: voteUri),
+
),
+
replies: replies,
+
);
+
}
+44 -106
test/providers/comments_provider_test.mocks.dart
···
// Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes
-
import 'dart:async' as _i6;
-
import 'dart:ui' as _i7;
+
import 'dart:async' as _i5;
+
import 'dart:ui' as _i6;
import 'package:coves_flutter/models/comment.dart' as _i3;
import 'package:coves_flutter/models/post.dart' as _i2;
-
import 'package:coves_flutter/providers/auth_provider.dart' as _i5;
-
import 'package:coves_flutter/providers/vote_provider.dart' as _i9;
-
import 'package:coves_flutter/services/coves_api_service.dart' as _i8;
-
import 'package:coves_flutter/services/vote_service.dart' as _i4;
+
import 'package:coves_flutter/providers/auth_provider.dart' as _i4;
+
import 'package:coves_flutter/providers/vote_provider.dart' as _i8;
+
import 'package:coves_flutter/services/coves_api_service.dart' as _i7;
import 'package:mockito/mockito.dart' as _i1;
// ignore_for_file: type=lint
···
: super(parent, parentInvocation);
}
-
class _FakeVoteResponse_2 extends _i1.SmartFake implements _i4.VoteResponse {
-
_FakeVoteResponse_2(Object parent, Invocation parentInvocation)
-
: super(parent, parentInvocation);
-
}
-
/// A class which mocks [AuthProvider].
///
/// See the documentation for Mockito's code generation for more information.
-
class MockAuthProvider extends _i1.Mock implements _i5.AuthProvider {
+
class MockAuthProvider extends _i1.Mock implements _i4.AuthProvider {
MockAuthProvider() {
_i1.throwOnMissingStub(this);
}
···
as bool);
@override
-
_i6.Future<String?> getAccessToken() =>
+
_i5.Future<String?> getAccessToken() =>
(super.noSuchMethod(
Invocation.method(#getAccessToken, []),
-
returnValue: _i6.Future<String?>.value(),
+
returnValue: _i5.Future<String?>.value(),
)
-
as _i6.Future<String?>);
+
as _i5.Future<String?>);
@override
-
_i6.Future<void> initialize() =>
+
_i5.Future<void> initialize() =>
(super.noSuchMethod(
Invocation.method(#initialize, []),
-
returnValue: _i6.Future<void>.value(),
-
returnValueForMissingStub: _i6.Future<void>.value(),
+
returnValue: _i5.Future<void>.value(),
+
returnValueForMissingStub: _i5.Future<void>.value(),
)
-
as _i6.Future<void>);
+
as _i5.Future<void>);
@override
-
_i6.Future<void> signIn(String? handle) =>
+
_i5.Future<void> signIn(String? handle) =>
(super.noSuchMethod(
Invocation.method(#signIn, [handle]),
-
returnValue: _i6.Future<void>.value(),
-
returnValueForMissingStub: _i6.Future<void>.value(),
+
returnValue: _i5.Future<void>.value(),
+
returnValueForMissingStub: _i5.Future<void>.value(),
)
-
as _i6.Future<void>);
+
as _i5.Future<void>);
@override
-
_i6.Future<void> signOut() =>
+
_i5.Future<void> signOut() =>
(super.noSuchMethod(
Invocation.method(#signOut, []),
-
returnValue: _i6.Future<void>.value(),
-
returnValueForMissingStub: _i6.Future<void>.value(),
+
returnValue: _i5.Future<void>.value(),
+
returnValueForMissingStub: _i5.Future<void>.value(),
)
-
as _i6.Future<void>);
+
as _i5.Future<void>);
@override
-
_i6.Future<bool> refreshToken() =>
+
_i5.Future<bool> refreshToken() =>
(super.noSuchMethod(
Invocation.method(#refreshToken, []),
-
returnValue: _i6.Future<bool>.value(false),
+
returnValue: _i5.Future<bool>.value(false),
)
-
as _i6.Future<bool>);
+
as _i5.Future<bool>);
@override
void clearError() => super.noSuchMethod(
···
);
@override
-
void addListener(_i7.VoidCallback? listener) => super.noSuchMethod(
+
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(#addListener, [listener]),
returnValueForMissingStub: null,
);
@override
-
void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(
+
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(#removeListener, [listener]),
returnValueForMissingStub: null,
);
···
/// A class which mocks [CovesApiService].
///
/// See the documentation for Mockito's code generation for more information.
-
class MockCovesApiService extends _i1.Mock implements _i8.CovesApiService {
+
class MockCovesApiService extends _i1.Mock implements _i7.CovesApiService {
MockCovesApiService() {
_i1.throwOnMissingStub(this);
}
@override
-
_i6.Future<_i2.TimelineResponse> getTimeline({
+
_i5.Future<_i2.TimelineResponse> getTimeline({
String? sort = 'hot',
String? timeframe,
int? limit = 15,
···
#limit: limit,
#cursor: cursor,
}),
-
returnValue: _i6.Future<_i2.TimelineResponse>.value(
+
returnValue: _i5.Future<_i2.TimelineResponse>.value(
_FakeTimelineResponse_0(
this,
Invocation.method(#getTimeline, [], {
···
),
),
)
-
as _i6.Future<_i2.TimelineResponse>);
+
as _i5.Future<_i2.TimelineResponse>);
@override
-
_i6.Future<_i2.TimelineResponse> getDiscover({
+
_i5.Future<_i2.TimelineResponse> getDiscover({
String? sort = 'hot',
String? timeframe,
int? limit = 15,
···
#limit: limit,
#cursor: cursor,
}),
-
returnValue: _i6.Future<_i2.TimelineResponse>.value(
+
returnValue: _i5.Future<_i2.TimelineResponse>.value(
_FakeTimelineResponse_0(
this,
Invocation.method(#getDiscover, [], {
···
),
),
)
-
as _i6.Future<_i2.TimelineResponse>);
+
as _i5.Future<_i2.TimelineResponse>);
@override
-
_i6.Future<_i3.CommentsResponse> getComments({
+
_i5.Future<_i3.CommentsResponse> getComments({
required String? postUri,
String? sort = 'hot',
String? timeframe,
···
#limit: limit,
#cursor: cursor,
}),
-
returnValue: _i6.Future<_i3.CommentsResponse>.value(
+
returnValue: _i5.Future<_i3.CommentsResponse>.value(
_FakeCommentsResponse_1(
this,
Invocation.method(#getComments, [], {
···
),
),
)
-
as _i6.Future<_i3.CommentsResponse>);
+
as _i5.Future<_i3.CommentsResponse>);
@override
void dispose() => super.noSuchMethod(
···
/// A class which mocks [VoteProvider].
///
/// See the documentation for Mockito's code generation for more information.
-
class MockVoteProvider extends _i1.Mock implements _i9.VoteProvider {
+
class MockVoteProvider extends _i1.Mock implements _i8.VoteProvider {
MockVoteProvider() {
_i1.throwOnMissingStub(this);
}
···
);
@override
-
_i9.VoteState? getVoteState(String? postUri) =>
+
_i8.VoteState? getVoteState(String? postUri) =>
(super.noSuchMethod(Invocation.method(#getVoteState, [postUri]))
-
as _i9.VoteState?);
+
as _i8.VoteState?);
@override
bool isLiked(String? postUri) =>
···
as int);
@override
-
_i6.Future<bool> toggleVote({
+
_i5.Future<bool> toggleVote({
required String? postUri,
required String? postCid,
String? direction = 'up',
···
#postCid: postCid,
#direction: direction,
}),
-
returnValue: _i6.Future<bool>.value(false),
+
returnValue: _i5.Future<bool>.value(false),
)
-
as _i6.Future<bool>);
+
as _i5.Future<bool>);
@override
void setInitialVoteState({
···
);
@override
-
void loadInitialVotes(Map<String, _i4.VoteInfo>? votes) => super.noSuchMethod(
-
Invocation.method(#loadInitialVotes, [votes]),
-
returnValueForMissingStub: null,
-
);
-
-
@override
void clear() => super.noSuchMethod(
Invocation.method(#clear, []),
returnValueForMissingStub: null,
);
@override
-
void addListener(_i7.VoidCallback? listener) => super.noSuchMethod(
+
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(#addListener, [listener]),
returnValueForMissingStub: null,
);
@override
-
void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod(
+
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
Invocation.method(#removeListener, [listener]),
returnValueForMissingStub: null,
);
···
returnValueForMissingStub: null,
);
}
-
-
/// A class which mocks [VoteService].
-
///
-
/// See the documentation for Mockito's code generation for more information.
-
class MockVoteService extends _i1.Mock implements _i4.VoteService {
-
MockVoteService() {
-
_i1.throwOnMissingStub(this);
-
}
-
-
@override
-
_i6.Future<Map<String, _i4.VoteInfo>> getUserVotes() =>
-
(super.noSuchMethod(
-
Invocation.method(#getUserVotes, []),
-
returnValue: _i6.Future<Map<String, _i4.VoteInfo>>.value(
-
<String, _i4.VoteInfo>{},
-
),
-
)
-
as _i6.Future<Map<String, _i4.VoteInfo>>);
-
-
@override
-
_i6.Future<_i4.VoteResponse> createVote({
-
required String? postUri,
-
required String? postCid,
-
String? direction = 'up',
-
String? existingVoteRkey,
-
String? existingVoteDirection,
-
}) =>
-
(super.noSuchMethod(
-
Invocation.method(#createVote, [], {
-
#postUri: postUri,
-
#postCid: postCid,
-
#direction: direction,
-
#existingVoteRkey: existingVoteRkey,
-
#existingVoteDirection: existingVoteDirection,
-
}),
-
returnValue: _i6.Future<_i4.VoteResponse>.value(
-
_FakeVoteResponse_2(
-
this,
-
Invocation.method(#createVote, [], {
-
#postUri: postUri,
-
#postCid: postCid,
-
#direction: direction,
-
#existingVoteRkey: existingVoteRkey,
-
#existingVoteDirection: existingVoteDirection,
-
}),
-
),
-
),
-
)
-
as _i6.Future<_i4.VoteResponse>);
-
}
+229 -1
test/providers/feed_provider_test.dart
···
import 'package:coves_flutter/models/post.dart';
import 'package:coves_flutter/providers/auth_provider.dart';
import 'package:coves_flutter/providers/feed_provider.dart';
+
import 'package:coves_flutter/providers/vote_provider.dart';
import 'package:coves_flutter/services/coves_api_service.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
···
import 'feed_provider_test.mocks.dart';
// Generate mocks
-
@GenerateMocks([AuthProvider, CovesApiService])
+
@GenerateMocks([AuthProvider, CovesApiService, VoteProvider])
void main() {
group('FeedProvider', () {
late FeedProvider feedProvider;
···
expect(feedProvider.isLoading, false);
});
});
+
+
group('Vote state initialization from viewer data', () {
+
late MockVoteProvider mockVoteProvider;
+
late FeedProvider feedProviderWithVotes;
+
+
setUp(() {
+
mockVoteProvider = MockVoteProvider();
+
feedProviderWithVotes = FeedProvider(
+
mockAuthProvider,
+
apiService: mockApiService,
+
voteProvider: mockVoteProvider,
+
);
+
});
+
+
tearDown(() {
+
feedProviderWithVotes.dispose();
+
});
+
+
test('should initialize vote state when viewer.vote is "up"', () async {
+
when(mockAuthProvider.isAuthenticated).thenReturn(true);
+
+
final mockResponse = TimelineResponse(
+
feed: [
+
_createMockPostWithViewer(
+
uri: 'at://did:plc:test/social.coves.post.record/1',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
],
+
cursor: 'cursor',
+
);
+
+
when(
+
mockApiService.getTimeline(
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => mockResponse);
+
+
await feedProviderWithVotes.fetchTimeline(refresh: true);
+
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'at://did:plc:test/social.coves.post.record/1',
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
).called(1);
+
});
+
+
test('should initialize vote state when viewer.vote is "down"', () async {
+
when(mockAuthProvider.isAuthenticated).thenReturn(true);
+
+
final mockResponse = TimelineResponse(
+
feed: [
+
_createMockPostWithViewer(
+
uri: 'at://did:plc:test/social.coves.post.record/1',
+
vote: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
],
+
cursor: 'cursor',
+
);
+
+
when(
+
mockApiService.getTimeline(
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => mockResponse);
+
+
await feedProviderWithVotes.fetchTimeline(refresh: true);
+
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'at://did:plc:test/social.coves.post.record/1',
+
voteDirection: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
).called(1);
+
});
+
+
test(
+
'should clear stale vote state when viewer.vote is null on refresh',
+
() async {
+
when(mockAuthProvider.isAuthenticated).thenReturn(true);
+
+
// Feed item with null vote (user removed vote on another device)
+
final mockResponse = TimelineResponse(
+
feed: [
+
_createMockPostWithViewer(
+
uri: 'at://did:plc:test/social.coves.post.record/1',
+
vote: null,
+
voteUri: null,
+
),
+
],
+
cursor: 'cursor',
+
);
+
+
when(
+
mockApiService.getTimeline(
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => mockResponse);
+
+
await feedProviderWithVotes.fetchTimeline(refresh: true);
+
+
// Should call setInitialVoteState with null to clear stale state
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: 'at://did:plc:test/social.coves.post.record/1',
+
voteDirection: null,
+
voteUri: null,
+
),
+
).called(1);
+
},
+
);
+
+
test(
+
'should initialize vote state for all feed items including no viewer',
+
() async {
+
when(mockAuthProvider.isAuthenticated).thenReturn(true);
+
+
final mockResponse = TimelineResponse(
+
feed: [
+
_createMockPostWithViewer(
+
uri: 'at://did:plc:test/social.coves.post.record/1',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
_createMockPost(), // No viewer state
+
],
+
cursor: 'cursor',
+
);
+
+
when(
+
mockApiService.getTimeline(
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => mockResponse);
+
+
await feedProviderWithVotes.fetchTimeline(refresh: true);
+
+
// Should be called for both posts
+
verify(
+
mockVoteProvider.setInitialVoteState(
+
postUri: anyNamed('postUri'),
+
voteDirection: anyNamed('voteDirection'),
+
voteUri: anyNamed('voteUri'),
+
),
+
).called(2);
+
},
+
);
+
+
test('should not initialize vote state when not authenticated', () async {
+
when(mockAuthProvider.isAuthenticated).thenReturn(false);
+
+
final mockResponse = TimelineResponse(
+
feed: [
+
_createMockPostWithViewer(
+
uri: 'at://did:plc:test/social.coves.post.record/1',
+
vote: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/vote1',
+
),
+
],
+
cursor: 'cursor',
+
);
+
+
when(
+
mockApiService.getDiscover(
+
sort: anyNamed('sort'),
+
timeframe: anyNamed('timeframe'),
+
limit: anyNamed('limit'),
+
cursor: anyNamed('cursor'),
+
),
+
).thenAnswer((_) async => mockResponse);
+
+
await feedProviderWithVotes.fetchDiscover(refresh: true);
+
+
// Should NOT call setInitialVoteState when not authenticated
+
verifyNever(
+
mockVoteProvider.setInitialVoteState(
+
postUri: anyNamed('postUri'),
+
voteDirection: anyNamed('voteDirection'),
+
voteUri: anyNamed('voteUri'),
+
),
+
);
+
});
+
});
});
}
···
),
);
}
+
+
// Helper function to create mock posts with viewer state
+
FeedViewPost _createMockPostWithViewer({
+
required String uri,
+
String? vote,
+
String? voteUri,
+
}) {
+
return FeedViewPost(
+
post: PostView(
+
uri: uri,
+
cid: 'test-cid',
+
rkey: 'test-rkey',
+
author: AuthorView(
+
did: 'did:plc:author',
+
handle: 'test.user',
+
displayName: 'Test User',
+
),
+
community: CommunityRef(did: 'did:plc:community', name: 'test-community'),
+
createdAt: DateTime.parse('2025-01-01T12:00:00Z'),
+
indexedAt: DateTime.parse('2025-01-01T12:00:00Z'),
+
text: 'Test body',
+
title: 'Test Post',
+
stats: PostStats(score: 42, upvotes: 50, downvotes: 8, commentCount: 5),
+
facets: [],
+
viewer: ViewerState(vote: vote, voteUri: voteUri),
+
),
+
);
+
}
+104
test/providers/feed_provider_test.mocks.dart
···
import 'package:coves_flutter/models/comment.dart' as _i3;
import 'package:coves_flutter/models/post.dart' as _i2;
import 'package:coves_flutter/providers/auth_provider.dart' as _i4;
+
import 'package:coves_flutter/providers/vote_provider.dart' as _i8;
import 'package:coves_flutter/services/coves_api_service.dart' as _i7;
import 'package:mockito/mockito.dart' as _i1;
···
returnValueForMissingStub: null,
);
}
+
+
/// A class which mocks [VoteProvider].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockVoteProvider extends _i1.Mock implements _i8.VoteProvider {
+
MockVoteProvider() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
bool get hasListeners =>
+
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false)
+
as bool);
+
+
@override
+
void dispose() => super.noSuchMethod(
+
Invocation.method(#dispose, []),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i8.VoteState? getVoteState(String? postUri) =>
+
(super.noSuchMethod(Invocation.method(#getVoteState, [postUri]))
+
as _i8.VoteState?);
+
+
@override
+
bool isLiked(String? postUri) =>
+
(super.noSuchMethod(
+
Invocation.method(#isLiked, [postUri]),
+
returnValue: false,
+
)
+
as bool);
+
+
@override
+
bool isPending(String? postUri) =>
+
(super.noSuchMethod(
+
Invocation.method(#isPending, [postUri]),
+
returnValue: false,
+
)
+
as bool);
+
+
@override
+
int getAdjustedScore(String? postUri, int? serverScore) =>
+
(super.noSuchMethod(
+
Invocation.method(#getAdjustedScore, [postUri, serverScore]),
+
returnValue: 0,
+
)
+
as int);
+
+
@override
+
_i5.Future<bool> toggleVote({
+
required String? postUri,
+
required String? postCid,
+
String? direction = 'up',
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#toggleVote, [], {
+
#postUri: postUri,
+
#postCid: postCid,
+
#direction: direction,
+
}),
+
returnValue: _i5.Future<bool>.value(false),
+
)
+
as _i5.Future<bool>);
+
+
@override
+
void setInitialVoteState({
+
required String? postUri,
+
String? voteDirection,
+
String? voteUri,
+
}) => super.noSuchMethod(
+
Invocation.method(#setInitialVoteState, [], {
+
#postUri: postUri,
+
#voteDirection: voteDirection,
+
#voteUri: voteUri,
+
}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void clear() => super.noSuchMethod(
+
Invocation.method(#clear, []),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void addListener(_i6.VoidCallback? listener) => super.noSuchMethod(
+
Invocation.method(#addListener, [listener]),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void removeListener(_i6.VoidCallback? listener) => super.noSuchMethod(
+
Invocation.method(#removeListener, [listener]),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void notifyListeners() => super.noSuchMethod(
+
Invocation.method(#notifyListeners, []),
+
returnValueForMissingStub: null,
+
);
+
}
+134 -28
test/providers/vote_provider_test.dart
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer(
(_) async => const VoteResponse(
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer((_) async => const VoteResponse(deleted: true));
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenThrow(ApiException('Network error', statusCode: 500));
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenThrow(NetworkException('Connection failed'));
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer((_) async {
await Future.delayed(const Duration(milliseconds: 100));
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).called(1);
});
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer(
(_) async => const VoteResponse(
···
expect(voteState?.deleted, false);
});
+
test('should set initial vote state with "down" direction', () {
+
voteProvider.setInitialVoteState(
+
postUri: testPostUri,
+
voteDirection: 'down',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/456',
+
);
+
+
// Should not be "liked" (isLiked checks for 'up' direction)
+
expect(voteProvider.isLiked(testPostUri), false);
+
+
final voteState = voteProvider.getVoteState(testPostUri);
+
expect(voteState?.direction, 'down');
+
expect(voteState?.uri, 'at://did:plc:test/social.coves.feed.vote/456');
+
expect(voteState?.deleted, false);
+
});
+
+
test('should extract rkey from voteUri', () {
+
voteProvider.setInitialVoteState(
+
postUri: testPostUri,
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/3kbyxyz123',
+
);
+
+
final voteState = voteProvider.getVoteState(testPostUri);
+
expect(voteState?.rkey, '3kbyxyz123');
+
});
+
+
test('should handle voteUri being null', () {
+
voteProvider.setInitialVoteState(
+
postUri: testPostUri,
+
voteDirection: 'up',
+
);
+
+
final voteState = voteProvider.getVoteState(testPostUri);
+
expect(voteState?.direction, 'up');
+
expect(voteState?.uri, null);
+
expect(voteState?.rkey, null);
+
expect(voteState?.deleted, false);
+
});
+
test('should remove vote state when voteDirection is null', () {
// First set a vote
voteProvider.setInitialVoteState(
···
expect(voteProvider.getVoteState(testPostUri), null);
});
+
test('should clear stale vote state when refreshing with null vote', () {
+
// Simulate initial state from previous session
+
voteProvider.setInitialVoteState(
+
postUri: testPostUri,
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/456',
+
);
+
+
expect(voteProvider.isLiked(testPostUri), true);
+
+
// Simulate refresh where server returns viewer.vote = null
+
// (user removed vote on another device)
+
voteProvider.setInitialVoteState(
+
postUri: testPostUri,
+
voteDirection: null,
+
);
+
+
// Vote should be cleared
+
expect(voteProvider.isLiked(testPostUri), false);
+
expect(voteProvider.getVoteState(testPostUri), null);
+
});
+
+
test('should clear stale score adjustment on refresh', () async {
+
// Simulate optimistic upvote that created a +1 adjustment
+
when(
+
mockVoteService.createVote(
+
postUri: anyNamed('postUri'),
+
postCid: anyNamed('postCid'),
+
direction: anyNamed('direction'),
+
),
+
).thenAnswer(
+
(_) async => const VoteResponse(
+
uri: 'at://did:plc:test/social.coves.feed.vote/456',
+
cid: 'bafy123',
+
rkey: '456',
+
deleted: false,
+
),
+
);
+
+
// Create vote - this sets _scoreAdjustments[testPostUri] = +1
+
await voteProvider.toggleVote(
+
postUri: testPostUri,
+
postCid: 'bafy2bzacepostcid123',
+
);
+
+
// Verify adjustment exists
+
const serverScore = 10;
+
expect(voteProvider.getAdjustedScore(testPostUri, serverScore), 11);
+
+
// Now simulate a feed refresh - server returns fresh score (11)
+
// which already includes the vote. The adjustment should be cleared.
+
voteProvider.setInitialVoteState(
+
postUri: testPostUri,
+
voteDirection: 'up',
+
voteUri: 'at://did:plc:test/social.coves.feed.vote/456',
+
);
+
+
// After refresh, adjustment should be cleared (server score is truth)
+
// If we pass the NEW server score (11), we should get 11, not 12
+
const freshServerScore = 11;
+
expect(
+
voteProvider.getAdjustedScore(testPostUri, freshServerScore),
+
11,
+
);
+
});
+
test('should not notify listeners when setting initial state', () {
var notificationCount = 0;
voteProvider
···
});
});
+
group('VoteState.extractRkeyFromUri', () {
+
test('should extract rkey from valid AT-URI', () {
+
expect(
+
VoteState.extractRkeyFromUri(
+
'at://did:plc:test/social.coves.feed.vote/3kbyxyz123',
+
),
+
'3kbyxyz123',
+
);
+
});
+
+
test('should return null for null uri', () {
+
expect(VoteState.extractRkeyFromUri(null), null);
+
});
+
+
test('should handle URI with no path segments', () {
+
expect(VoteState.extractRkeyFromUri(''), '');
+
});
+
+
test('should handle complex rkey values', () {
+
expect(
+
VoteState.extractRkeyFromUri(
+
'at://did:plc:abc123xyz/social.coves.feed.vote/3lbp7kw2abc',
+
),
+
'3lbp7kw2abc',
+
);
+
});
+
});
+
group('clear', () {
test('should clear all vote state', () {
const post1 = 'at://did:plc:test/social.coves.post.record/1';
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer((_) async {
await Future.delayed(const Duration(milliseconds: 50));
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer(
(_) async => const VoteResponse(
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer((_) async => const VoteResponse(deleted: true));
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer(
(_) async => const VoteResponse(
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer(
(_) async => const VoteResponse(
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenAnswer(
(_) async => const VoteResponse(
···
postUri: anyNamed('postUri'),
postCid: anyNamed('postCid'),
direction: anyNamed('direction'),
-
existingVoteRkey: anyNamed('existingVoteRkey'),
-
existingVoteDirection: anyNamed('existingVoteDirection'),
),
).thenThrow(ApiException('Network error', statusCode: 500));
-16
test/providers/vote_provider_test.mocks.dart
···
}
@override
-
_i3.Future<Map<String, _i2.VoteInfo>> getUserVotes() =>
-
(super.noSuchMethod(
-
Invocation.method(#getUserVotes, []),
-
returnValue: _i3.Future<Map<String, _i2.VoteInfo>>.value(
-
<String, _i2.VoteInfo>{},
-
),
-
)
-
as _i3.Future<Map<String, _i2.VoteInfo>>);
-
-
@override
_i3.Future<_i2.VoteResponse> createVote({
required String? postUri,
required String? postCid,
String? direction = 'up',
-
String? existingVoteRkey,
-
String? existingVoteDirection,
}) =>
(super.noSuchMethod(
Invocation.method(#createVote, [], {
#postUri: postUri,
#postCid: postCid,
#direction: direction,
-
#existingVoteRkey: existingVoteRkey,
-
#existingVoteDirection: existingVoteDirection,
}),
returnValue: _i3.Future<_i2.VoteResponse>.value(
_FakeVoteResponse_0(
···
#postUri: postUri,
#postCid: postCid,
#direction: direction,
-
#existingVoteRkey: existingVoteRkey,
-
#existingVoteDirection: existingVoteDirection,
}),
),
),
+1102
test/services/coves_auth_service_environment_test.mocks.dart
···
+
// Mocks generated by Mockito 5.4.6 from annotations
+
// in coves_flutter/test/services/coves_auth_service_environment_test.dart.
+
// Do not manually edit this file.
+
+
// ignore_for_file: no_leading_underscores_for_library_prefixes
+
import 'dart:async' as _i9;
+
+
import 'package:dio/src/adapter.dart' as _i4;
+
import 'package:dio/src/cancel_token.dart' as _i10;
+
import 'package:dio/src/dio.dart' as _i7;
+
import 'package:dio/src/dio_mixin.dart' as _i3;
+
import 'package:dio/src/options.dart' as _i2;
+
import 'package:dio/src/response.dart' as _i6;
+
import 'package:dio/src/transformer.dart' as _i5;
+
import 'package:flutter/foundation.dart' as _i11;
+
import 'package:flutter_secure_storage/flutter_secure_storage.dart' as _i8;
+
import 'package:mockito/mockito.dart' as _i1;
+
+
// ignore_for_file: type=lint
+
// ignore_for_file: avoid_redundant_argument_values
+
// ignore_for_file: avoid_setters_without_getters
+
// ignore_for_file: comment_references
+
// ignore_for_file: deprecated_member_use
+
// ignore_for_file: deprecated_member_use_from_same_package
+
// ignore_for_file: implementation_imports
+
// ignore_for_file: invalid_use_of_visible_for_testing_member
+
// ignore_for_file: must_be_immutable
+
// ignore_for_file: prefer_const_constructors
+
// ignore_for_file: unnecessary_parenthesis
+
// ignore_for_file: camel_case_types
+
// ignore_for_file: subtype_of_sealed_class
+
// ignore_for_file: invalid_use_of_internal_member
+
+
class _FakeBaseOptions_0 extends _i1.SmartFake implements _i2.BaseOptions {
+
_FakeBaseOptions_0(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeInterceptors_1 extends _i1.SmartFake implements _i3.Interceptors {
+
_FakeInterceptors_1(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeHttpClientAdapter_2 extends _i1.SmartFake
+
implements _i4.HttpClientAdapter {
+
_FakeHttpClientAdapter_2(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeTransformer_3 extends _i1.SmartFake implements _i5.Transformer {
+
_FakeTransformer_3(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeResponse_4<T1> extends _i1.SmartFake implements _i6.Response<T1> {
+
_FakeResponse_4(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeDio_5 extends _i1.SmartFake implements _i7.Dio {
+
_FakeDio_5(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeIOSOptions_6 extends _i1.SmartFake implements _i8.IOSOptions {
+
_FakeIOSOptions_6(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeAndroidOptions_7 extends _i1.SmartFake
+
implements _i8.AndroidOptions {
+
_FakeAndroidOptions_7(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeLinuxOptions_8 extends _i1.SmartFake implements _i8.LinuxOptions {
+
_FakeLinuxOptions_8(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeWindowsOptions_9 extends _i1.SmartFake
+
implements _i8.WindowsOptions {
+
_FakeWindowsOptions_9(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeWebOptions_10 extends _i1.SmartFake implements _i8.WebOptions {
+
_FakeWebOptions_10(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeMacOsOptions_11 extends _i1.SmartFake implements _i8.MacOsOptions {
+
_FakeMacOsOptions_11(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
/// A class which mocks [Dio].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockDio extends _i1.Mock implements _i7.Dio {
+
MockDio() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
_i2.BaseOptions get options =>
+
(super.noSuchMethod(
+
Invocation.getter(#options),
+
returnValue: _FakeBaseOptions_0(this, Invocation.getter(#options)),
+
)
+
as _i2.BaseOptions);
+
+
@override
+
_i3.Interceptors get interceptors =>
+
(super.noSuchMethod(
+
Invocation.getter(#interceptors),
+
returnValue: _FakeInterceptors_1(
+
this,
+
Invocation.getter(#interceptors),
+
),
+
)
+
as _i3.Interceptors);
+
+
@override
+
_i4.HttpClientAdapter get httpClientAdapter =>
+
(super.noSuchMethod(
+
Invocation.getter(#httpClientAdapter),
+
returnValue: _FakeHttpClientAdapter_2(
+
this,
+
Invocation.getter(#httpClientAdapter),
+
),
+
)
+
as _i4.HttpClientAdapter);
+
+
@override
+
_i5.Transformer get transformer =>
+
(super.noSuchMethod(
+
Invocation.getter(#transformer),
+
returnValue: _FakeTransformer_3(
+
this,
+
Invocation.getter(#transformer),
+
),
+
)
+
as _i5.Transformer);
+
+
@override
+
set options(_i2.BaseOptions? value) => super.noSuchMethod(
+
Invocation.setter(#options, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
set httpClientAdapter(_i4.HttpClientAdapter? value) => super.noSuchMethod(
+
Invocation.setter(#httpClientAdapter, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
set transformer(_i5.Transformer? value) => super.noSuchMethod(
+
Invocation.setter(#transformer, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void close({bool? force = false}) => super.noSuchMethod(
+
Invocation.method(#close, [], {#force: force}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i9.Future<_i6.Response<T>> head<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#head,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#head,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> headUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#headUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#headUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> get<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#get,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#get,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> getUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#getUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#getUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> post<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#post,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#post,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> postUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#postUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#postUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> put<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#put,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#put,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> putUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#putUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#putUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> patch<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#patch,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#patch,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> patchUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#patchUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#patchUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> delete<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#delete,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#delete,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> deleteUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#deleteUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#deleteUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<dynamic>> download(
+
String? urlPath,
+
dynamic savePath, {
+
_i2.ProgressCallback? onReceiveProgress,
+
Map<String, dynamic>? queryParameters,
+
_i10.CancelToken? cancelToken,
+
bool? deleteOnError = true,
+
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
+
String? lengthHeader = 'content-length',
+
Object? data,
+
_i2.Options? options,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#download,
+
[urlPath, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<dynamic>>.value(
+
_FakeResponse_4<dynamic>(
+
this,
+
Invocation.method(
+
#download,
+
[urlPath, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<dynamic>>);
+
+
@override
+
_i9.Future<_i6.Response<dynamic>> downloadUri(
+
Uri? uri,
+
dynamic savePath, {
+
_i2.ProgressCallback? onReceiveProgress,
+
_i10.CancelToken? cancelToken,
+
bool? deleteOnError = true,
+
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
+
String? lengthHeader = 'content-length',
+
Object? data,
+
_i2.Options? options,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#downloadUri,
+
[uri, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<dynamic>>.value(
+
_FakeResponse_4<dynamic>(
+
this,
+
Invocation.method(
+
#downloadUri,
+
[uri, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<dynamic>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> request<T>(
+
String? url, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i10.CancelToken? cancelToken,
+
_i2.Options? options,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#request,
+
[url],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#request,
+
[url],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> requestUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i10.CancelToken? cancelToken,
+
_i2.Options? options,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#requestUri,
+
[uri],
+
{
+
#data: data,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#requestUri,
+
[uri],
+
{
+
#data: data,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> fetch<T>(_i2.RequestOptions? requestOptions) =>
+
(super.noSuchMethod(
+
Invocation.method(#fetch, [requestOptions]),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(#fetch, [requestOptions]),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i7.Dio clone({
+
_i2.BaseOptions? options,
+
_i3.Interceptors? interceptors,
+
_i4.HttpClientAdapter? httpClientAdapter,
+
_i5.Transformer? transformer,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#clone, [], {
+
#options: options,
+
#interceptors: interceptors,
+
#httpClientAdapter: httpClientAdapter,
+
#transformer: transformer,
+
}),
+
returnValue: _FakeDio_5(
+
this,
+
Invocation.method(#clone, [], {
+
#options: options,
+
#interceptors: interceptors,
+
#httpClientAdapter: httpClientAdapter,
+
#transformer: transformer,
+
}),
+
),
+
)
+
as _i7.Dio);
+
}
+
+
/// A class which mocks [FlutterSecureStorage].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockFlutterSecureStorage extends _i1.Mock
+
implements _i8.FlutterSecureStorage {
+
MockFlutterSecureStorage() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
_i8.IOSOptions get iOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#iOptions),
+
returnValue: _FakeIOSOptions_6(this, Invocation.getter(#iOptions)),
+
)
+
as _i8.IOSOptions);
+
+
@override
+
_i8.AndroidOptions get aOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#aOptions),
+
returnValue: _FakeAndroidOptions_7(
+
this,
+
Invocation.getter(#aOptions),
+
),
+
)
+
as _i8.AndroidOptions);
+
+
@override
+
_i8.LinuxOptions get lOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#lOptions),
+
returnValue: _FakeLinuxOptions_8(
+
this,
+
Invocation.getter(#lOptions),
+
),
+
)
+
as _i8.LinuxOptions);
+
+
@override
+
_i8.WindowsOptions get wOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#wOptions),
+
returnValue: _FakeWindowsOptions_9(
+
this,
+
Invocation.getter(#wOptions),
+
),
+
)
+
as _i8.WindowsOptions);
+
+
@override
+
_i8.WebOptions get webOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#webOptions),
+
returnValue: _FakeWebOptions_10(
+
this,
+
Invocation.getter(#webOptions),
+
),
+
)
+
as _i8.WebOptions);
+
+
@override
+
_i8.MacOsOptions get mOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#mOptions),
+
returnValue: _FakeMacOsOptions_11(
+
this,
+
Invocation.getter(#mOptions),
+
),
+
)
+
as _i8.MacOsOptions);
+
+
@override
+
void registerListener({
+
required String? key,
+
required _i11.ValueChanged<String?>? listener,
+
}) => super.noSuchMethod(
+
Invocation.method(#registerListener, [], {#key: key, #listener: listener}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterListener({
+
required String? key,
+
required _i11.ValueChanged<String?>? listener,
+
}) => super.noSuchMethod(
+
Invocation.method(#unregisterListener, [], {
+
#key: key,
+
#listener: listener,
+
}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterAllListenersForKey({required String? key}) =>
+
super.noSuchMethod(
+
Invocation.method(#unregisterAllListenersForKey, [], {#key: key}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterAllListeners() => super.noSuchMethod(
+
Invocation.method(#unregisterAllListeners, []),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i9.Future<void> write({
+
required String? key,
+
required String? value,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#write, [], {
+
#key: key,
+
#value: value,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<String?> read({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#read, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<String?>.value(),
+
)
+
as _i9.Future<String?>);
+
+
@override
+
_i9.Future<bool> containsKey({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#containsKey, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<bool>.value(false),
+
)
+
as _i9.Future<bool>);
+
+
@override
+
_i9.Future<void> delete({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#delete, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<Map<String, String>> readAll({
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#readAll, [], {
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<Map<String, String>>.value(
+
<String, String>{},
+
),
+
)
+
as _i9.Future<Map<String, String>>);
+
+
@override
+
_i9.Future<void> deleteAll({
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#deleteAll, [], {
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<bool?> isCupertinoProtectedDataAvailable() =>
+
(super.noSuchMethod(
+
Invocation.method(#isCupertinoProtectedDataAvailable, []),
+
returnValue: _i9.Future<bool?>.value(),
+
)
+
as _i9.Future<bool?>);
+
}
+1102
test/services/coves_auth_service_singleton_test.mocks.dart
···
+
// Mocks generated by Mockito 5.4.6 from annotations
+
// in coves_flutter/test/services/coves_auth_service_singleton_test.dart.
+
// Do not manually edit this file.
+
+
// ignore_for_file: no_leading_underscores_for_library_prefixes
+
import 'dart:async' as _i9;
+
+
import 'package:dio/src/adapter.dart' as _i4;
+
import 'package:dio/src/cancel_token.dart' as _i10;
+
import 'package:dio/src/dio.dart' as _i7;
+
import 'package:dio/src/dio_mixin.dart' as _i3;
+
import 'package:dio/src/options.dart' as _i2;
+
import 'package:dio/src/response.dart' as _i6;
+
import 'package:dio/src/transformer.dart' as _i5;
+
import 'package:flutter/foundation.dart' as _i11;
+
import 'package:flutter_secure_storage/flutter_secure_storage.dart' as _i8;
+
import 'package:mockito/mockito.dart' as _i1;
+
+
// ignore_for_file: type=lint
+
// ignore_for_file: avoid_redundant_argument_values
+
// ignore_for_file: avoid_setters_without_getters
+
// ignore_for_file: comment_references
+
// ignore_for_file: deprecated_member_use
+
// ignore_for_file: deprecated_member_use_from_same_package
+
// ignore_for_file: implementation_imports
+
// ignore_for_file: invalid_use_of_visible_for_testing_member
+
// ignore_for_file: must_be_immutable
+
// ignore_for_file: prefer_const_constructors
+
// ignore_for_file: unnecessary_parenthesis
+
// ignore_for_file: camel_case_types
+
// ignore_for_file: subtype_of_sealed_class
+
// ignore_for_file: invalid_use_of_internal_member
+
+
class _FakeBaseOptions_0 extends _i1.SmartFake implements _i2.BaseOptions {
+
_FakeBaseOptions_0(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeInterceptors_1 extends _i1.SmartFake implements _i3.Interceptors {
+
_FakeInterceptors_1(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeHttpClientAdapter_2 extends _i1.SmartFake
+
implements _i4.HttpClientAdapter {
+
_FakeHttpClientAdapter_2(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeTransformer_3 extends _i1.SmartFake implements _i5.Transformer {
+
_FakeTransformer_3(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeResponse_4<T1> extends _i1.SmartFake implements _i6.Response<T1> {
+
_FakeResponse_4(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeDio_5 extends _i1.SmartFake implements _i7.Dio {
+
_FakeDio_5(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeIOSOptions_6 extends _i1.SmartFake implements _i8.IOSOptions {
+
_FakeIOSOptions_6(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeAndroidOptions_7 extends _i1.SmartFake
+
implements _i8.AndroidOptions {
+
_FakeAndroidOptions_7(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeLinuxOptions_8 extends _i1.SmartFake implements _i8.LinuxOptions {
+
_FakeLinuxOptions_8(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeWindowsOptions_9 extends _i1.SmartFake
+
implements _i8.WindowsOptions {
+
_FakeWindowsOptions_9(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeWebOptions_10 extends _i1.SmartFake implements _i8.WebOptions {
+
_FakeWebOptions_10(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeMacOsOptions_11 extends _i1.SmartFake implements _i8.MacOsOptions {
+
_FakeMacOsOptions_11(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
/// A class which mocks [Dio].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockDio extends _i1.Mock implements _i7.Dio {
+
MockDio() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
_i2.BaseOptions get options =>
+
(super.noSuchMethod(
+
Invocation.getter(#options),
+
returnValue: _FakeBaseOptions_0(this, Invocation.getter(#options)),
+
)
+
as _i2.BaseOptions);
+
+
@override
+
_i3.Interceptors get interceptors =>
+
(super.noSuchMethod(
+
Invocation.getter(#interceptors),
+
returnValue: _FakeInterceptors_1(
+
this,
+
Invocation.getter(#interceptors),
+
),
+
)
+
as _i3.Interceptors);
+
+
@override
+
_i4.HttpClientAdapter get httpClientAdapter =>
+
(super.noSuchMethod(
+
Invocation.getter(#httpClientAdapter),
+
returnValue: _FakeHttpClientAdapter_2(
+
this,
+
Invocation.getter(#httpClientAdapter),
+
),
+
)
+
as _i4.HttpClientAdapter);
+
+
@override
+
_i5.Transformer get transformer =>
+
(super.noSuchMethod(
+
Invocation.getter(#transformer),
+
returnValue: _FakeTransformer_3(
+
this,
+
Invocation.getter(#transformer),
+
),
+
)
+
as _i5.Transformer);
+
+
@override
+
set options(_i2.BaseOptions? value) => super.noSuchMethod(
+
Invocation.setter(#options, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
set httpClientAdapter(_i4.HttpClientAdapter? value) => super.noSuchMethod(
+
Invocation.setter(#httpClientAdapter, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
set transformer(_i5.Transformer? value) => super.noSuchMethod(
+
Invocation.setter(#transformer, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void close({bool? force = false}) => super.noSuchMethod(
+
Invocation.method(#close, [], {#force: force}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i9.Future<_i6.Response<T>> head<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#head,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#head,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> headUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#headUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#headUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> get<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#get,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#get,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> getUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#getUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#getUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> post<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#post,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#post,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> postUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#postUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#postUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> put<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#put,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#put,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> putUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#putUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#putUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> patch<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#patch,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#patch,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> patchUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#patchUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#patchUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> delete<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#delete,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#delete,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> deleteUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#deleteUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#deleteUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<dynamic>> download(
+
String? urlPath,
+
dynamic savePath, {
+
_i2.ProgressCallback? onReceiveProgress,
+
Map<String, dynamic>? queryParameters,
+
_i10.CancelToken? cancelToken,
+
bool? deleteOnError = true,
+
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
+
String? lengthHeader = 'content-length',
+
Object? data,
+
_i2.Options? options,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#download,
+
[urlPath, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<dynamic>>.value(
+
_FakeResponse_4<dynamic>(
+
this,
+
Invocation.method(
+
#download,
+
[urlPath, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<dynamic>>);
+
+
@override
+
_i9.Future<_i6.Response<dynamic>> downloadUri(
+
Uri? uri,
+
dynamic savePath, {
+
_i2.ProgressCallback? onReceiveProgress,
+
_i10.CancelToken? cancelToken,
+
bool? deleteOnError = true,
+
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
+
String? lengthHeader = 'content-length',
+
Object? data,
+
_i2.Options? options,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#downloadUri,
+
[uri, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<dynamic>>.value(
+
_FakeResponse_4<dynamic>(
+
this,
+
Invocation.method(
+
#downloadUri,
+
[uri, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<dynamic>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> request<T>(
+
String? url, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i10.CancelToken? cancelToken,
+
_i2.Options? options,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#request,
+
[url],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#request,
+
[url],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> requestUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i10.CancelToken? cancelToken,
+
_i2.Options? options,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#requestUri,
+
[uri],
+
{
+
#data: data,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#requestUri,
+
[uri],
+
{
+
#data: data,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> fetch<T>(_i2.RequestOptions? requestOptions) =>
+
(super.noSuchMethod(
+
Invocation.method(#fetch, [requestOptions]),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(#fetch, [requestOptions]),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i7.Dio clone({
+
_i2.BaseOptions? options,
+
_i3.Interceptors? interceptors,
+
_i4.HttpClientAdapter? httpClientAdapter,
+
_i5.Transformer? transformer,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#clone, [], {
+
#options: options,
+
#interceptors: interceptors,
+
#httpClientAdapter: httpClientAdapter,
+
#transformer: transformer,
+
}),
+
returnValue: _FakeDio_5(
+
this,
+
Invocation.method(#clone, [], {
+
#options: options,
+
#interceptors: interceptors,
+
#httpClientAdapter: httpClientAdapter,
+
#transformer: transformer,
+
}),
+
),
+
)
+
as _i7.Dio);
+
}
+
+
/// A class which mocks [FlutterSecureStorage].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockFlutterSecureStorage extends _i1.Mock
+
implements _i8.FlutterSecureStorage {
+
MockFlutterSecureStorage() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
_i8.IOSOptions get iOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#iOptions),
+
returnValue: _FakeIOSOptions_6(this, Invocation.getter(#iOptions)),
+
)
+
as _i8.IOSOptions);
+
+
@override
+
_i8.AndroidOptions get aOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#aOptions),
+
returnValue: _FakeAndroidOptions_7(
+
this,
+
Invocation.getter(#aOptions),
+
),
+
)
+
as _i8.AndroidOptions);
+
+
@override
+
_i8.LinuxOptions get lOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#lOptions),
+
returnValue: _FakeLinuxOptions_8(
+
this,
+
Invocation.getter(#lOptions),
+
),
+
)
+
as _i8.LinuxOptions);
+
+
@override
+
_i8.WindowsOptions get wOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#wOptions),
+
returnValue: _FakeWindowsOptions_9(
+
this,
+
Invocation.getter(#wOptions),
+
),
+
)
+
as _i8.WindowsOptions);
+
+
@override
+
_i8.WebOptions get webOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#webOptions),
+
returnValue: _FakeWebOptions_10(
+
this,
+
Invocation.getter(#webOptions),
+
),
+
)
+
as _i8.WebOptions);
+
+
@override
+
_i8.MacOsOptions get mOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#mOptions),
+
returnValue: _FakeMacOsOptions_11(
+
this,
+
Invocation.getter(#mOptions),
+
),
+
)
+
as _i8.MacOsOptions);
+
+
@override
+
void registerListener({
+
required String? key,
+
required _i11.ValueChanged<String?>? listener,
+
}) => super.noSuchMethod(
+
Invocation.method(#registerListener, [], {#key: key, #listener: listener}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterListener({
+
required String? key,
+
required _i11.ValueChanged<String?>? listener,
+
}) => super.noSuchMethod(
+
Invocation.method(#unregisterListener, [], {
+
#key: key,
+
#listener: listener,
+
}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterAllListenersForKey({required String? key}) =>
+
super.noSuchMethod(
+
Invocation.method(#unregisterAllListenersForKey, [], {#key: key}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterAllListeners() => super.noSuchMethod(
+
Invocation.method(#unregisterAllListeners, []),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i9.Future<void> write({
+
required String? key,
+
required String? value,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#write, [], {
+
#key: key,
+
#value: value,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<String?> read({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#read, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<String?>.value(),
+
)
+
as _i9.Future<String?>);
+
+
@override
+
_i9.Future<bool> containsKey({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#containsKey, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<bool>.value(false),
+
)
+
as _i9.Future<bool>);
+
+
@override
+
_i9.Future<void> delete({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#delete, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<Map<String, String>> readAll({
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#readAll, [], {
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<Map<String, String>>.value(
+
<String, String>{},
+
),
+
)
+
as _i9.Future<Map<String, String>>);
+
+
@override
+
_i9.Future<void> deleteAll({
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#deleteAll, [], {
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<bool?> isCupertinoProtectedDataAvailable() =>
+
(super.noSuchMethod(
+
Invocation.method(#isCupertinoProtectedDataAvailable, []),
+
returnValue: _i9.Future<bool?>.value(),
+
)
+
as _i9.Future<bool?>);
+
}
+1102
test/services/coves_auth_service_validation_test.mocks.dart
···
+
// Mocks generated by Mockito 5.4.6 from annotations
+
// in coves_flutter/test/services/coves_auth_service_validation_test.dart.
+
// Do not manually edit this file.
+
+
// ignore_for_file: no_leading_underscores_for_library_prefixes
+
import 'dart:async' as _i9;
+
+
import 'package:dio/src/adapter.dart' as _i4;
+
import 'package:dio/src/cancel_token.dart' as _i10;
+
import 'package:dio/src/dio.dart' as _i7;
+
import 'package:dio/src/dio_mixin.dart' as _i3;
+
import 'package:dio/src/options.dart' as _i2;
+
import 'package:dio/src/response.dart' as _i6;
+
import 'package:dio/src/transformer.dart' as _i5;
+
import 'package:flutter/foundation.dart' as _i11;
+
import 'package:flutter_secure_storage/flutter_secure_storage.dart' as _i8;
+
import 'package:mockito/mockito.dart' as _i1;
+
+
// ignore_for_file: type=lint
+
// ignore_for_file: avoid_redundant_argument_values
+
// ignore_for_file: avoid_setters_without_getters
+
// ignore_for_file: comment_references
+
// ignore_for_file: deprecated_member_use
+
// ignore_for_file: deprecated_member_use_from_same_package
+
// ignore_for_file: implementation_imports
+
// ignore_for_file: invalid_use_of_visible_for_testing_member
+
// ignore_for_file: must_be_immutable
+
// ignore_for_file: prefer_const_constructors
+
// ignore_for_file: unnecessary_parenthesis
+
// ignore_for_file: camel_case_types
+
// ignore_for_file: subtype_of_sealed_class
+
// ignore_for_file: invalid_use_of_internal_member
+
+
class _FakeBaseOptions_0 extends _i1.SmartFake implements _i2.BaseOptions {
+
_FakeBaseOptions_0(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeInterceptors_1 extends _i1.SmartFake implements _i3.Interceptors {
+
_FakeInterceptors_1(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeHttpClientAdapter_2 extends _i1.SmartFake
+
implements _i4.HttpClientAdapter {
+
_FakeHttpClientAdapter_2(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeTransformer_3 extends _i1.SmartFake implements _i5.Transformer {
+
_FakeTransformer_3(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeResponse_4<T1> extends _i1.SmartFake implements _i6.Response<T1> {
+
_FakeResponse_4(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeDio_5 extends _i1.SmartFake implements _i7.Dio {
+
_FakeDio_5(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeIOSOptions_6 extends _i1.SmartFake implements _i8.IOSOptions {
+
_FakeIOSOptions_6(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeAndroidOptions_7 extends _i1.SmartFake
+
implements _i8.AndroidOptions {
+
_FakeAndroidOptions_7(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeLinuxOptions_8 extends _i1.SmartFake implements _i8.LinuxOptions {
+
_FakeLinuxOptions_8(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeWindowsOptions_9 extends _i1.SmartFake
+
implements _i8.WindowsOptions {
+
_FakeWindowsOptions_9(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeWebOptions_10 extends _i1.SmartFake implements _i8.WebOptions {
+
_FakeWebOptions_10(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
class _FakeMacOsOptions_11 extends _i1.SmartFake implements _i8.MacOsOptions {
+
_FakeMacOsOptions_11(Object parent, Invocation parentInvocation)
+
: super(parent, parentInvocation);
+
}
+
+
/// A class which mocks [Dio].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockDio extends _i1.Mock implements _i7.Dio {
+
MockDio() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
_i2.BaseOptions get options =>
+
(super.noSuchMethod(
+
Invocation.getter(#options),
+
returnValue: _FakeBaseOptions_0(this, Invocation.getter(#options)),
+
)
+
as _i2.BaseOptions);
+
+
@override
+
_i3.Interceptors get interceptors =>
+
(super.noSuchMethod(
+
Invocation.getter(#interceptors),
+
returnValue: _FakeInterceptors_1(
+
this,
+
Invocation.getter(#interceptors),
+
),
+
)
+
as _i3.Interceptors);
+
+
@override
+
_i4.HttpClientAdapter get httpClientAdapter =>
+
(super.noSuchMethod(
+
Invocation.getter(#httpClientAdapter),
+
returnValue: _FakeHttpClientAdapter_2(
+
this,
+
Invocation.getter(#httpClientAdapter),
+
),
+
)
+
as _i4.HttpClientAdapter);
+
+
@override
+
_i5.Transformer get transformer =>
+
(super.noSuchMethod(
+
Invocation.getter(#transformer),
+
returnValue: _FakeTransformer_3(
+
this,
+
Invocation.getter(#transformer),
+
),
+
)
+
as _i5.Transformer);
+
+
@override
+
set options(_i2.BaseOptions? value) => super.noSuchMethod(
+
Invocation.setter(#options, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
set httpClientAdapter(_i4.HttpClientAdapter? value) => super.noSuchMethod(
+
Invocation.setter(#httpClientAdapter, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
set transformer(_i5.Transformer? value) => super.noSuchMethod(
+
Invocation.setter(#transformer, value),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void close({bool? force = false}) => super.noSuchMethod(
+
Invocation.method(#close, [], {#force: force}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i9.Future<_i6.Response<T>> head<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#head,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#head,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> headUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#headUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#headUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> get<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#get,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#get,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> getUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#getUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#getUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> post<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#post,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#post,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> postUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#postUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#postUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> put<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#put,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#put,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> putUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#putUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#putUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> patch<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#patch,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#patch,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> patchUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#patchUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#patchUri,
+
[uri],
+
{
+
#data: data,
+
#options: options,
+
#cancelToken: cancelToken,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> delete<T>(
+
String? path, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#delete,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#delete,
+
[path],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#options: options,
+
#cancelToken: cancelToken,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> deleteUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i2.Options? options,
+
_i10.CancelToken? cancelToken,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#deleteUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#deleteUri,
+
[uri],
+
{#data: data, #options: options, #cancelToken: cancelToken},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<dynamic>> download(
+
String? urlPath,
+
dynamic savePath, {
+
_i2.ProgressCallback? onReceiveProgress,
+
Map<String, dynamic>? queryParameters,
+
_i10.CancelToken? cancelToken,
+
bool? deleteOnError = true,
+
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
+
String? lengthHeader = 'content-length',
+
Object? data,
+
_i2.Options? options,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#download,
+
[urlPath, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<dynamic>>.value(
+
_FakeResponse_4<dynamic>(
+
this,
+
Invocation.method(
+
#download,
+
[urlPath, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<dynamic>>);
+
+
@override
+
_i9.Future<_i6.Response<dynamic>> downloadUri(
+
Uri? uri,
+
dynamic savePath, {
+
_i2.ProgressCallback? onReceiveProgress,
+
_i10.CancelToken? cancelToken,
+
bool? deleteOnError = true,
+
_i2.FileAccessMode? fileAccessMode = _i2.FileAccessMode.write,
+
String? lengthHeader = 'content-length',
+
Object? data,
+
_i2.Options? options,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#downloadUri,
+
[uri, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<dynamic>>.value(
+
_FakeResponse_4<dynamic>(
+
this,
+
Invocation.method(
+
#downloadUri,
+
[uri, savePath],
+
{
+
#onReceiveProgress: onReceiveProgress,
+
#cancelToken: cancelToken,
+
#deleteOnError: deleteOnError,
+
#fileAccessMode: fileAccessMode,
+
#lengthHeader: lengthHeader,
+
#data: data,
+
#options: options,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<dynamic>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> request<T>(
+
String? url, {
+
Object? data,
+
Map<String, dynamic>? queryParameters,
+
_i10.CancelToken? cancelToken,
+
_i2.Options? options,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#request,
+
[url],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#request,
+
[url],
+
{
+
#data: data,
+
#queryParameters: queryParameters,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> requestUri<T>(
+
Uri? uri, {
+
Object? data,
+
_i10.CancelToken? cancelToken,
+
_i2.Options? options,
+
_i2.ProgressCallback? onSendProgress,
+
_i2.ProgressCallback? onReceiveProgress,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(
+
#requestUri,
+
[uri],
+
{
+
#data: data,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(
+
#requestUri,
+
[uri],
+
{
+
#data: data,
+
#cancelToken: cancelToken,
+
#options: options,
+
#onSendProgress: onSendProgress,
+
#onReceiveProgress: onReceiveProgress,
+
},
+
),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i9.Future<_i6.Response<T>> fetch<T>(_i2.RequestOptions? requestOptions) =>
+
(super.noSuchMethod(
+
Invocation.method(#fetch, [requestOptions]),
+
returnValue: _i9.Future<_i6.Response<T>>.value(
+
_FakeResponse_4<T>(
+
this,
+
Invocation.method(#fetch, [requestOptions]),
+
),
+
),
+
)
+
as _i9.Future<_i6.Response<T>>);
+
+
@override
+
_i7.Dio clone({
+
_i2.BaseOptions? options,
+
_i3.Interceptors? interceptors,
+
_i4.HttpClientAdapter? httpClientAdapter,
+
_i5.Transformer? transformer,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#clone, [], {
+
#options: options,
+
#interceptors: interceptors,
+
#httpClientAdapter: httpClientAdapter,
+
#transformer: transformer,
+
}),
+
returnValue: _FakeDio_5(
+
this,
+
Invocation.method(#clone, [], {
+
#options: options,
+
#interceptors: interceptors,
+
#httpClientAdapter: httpClientAdapter,
+
#transformer: transformer,
+
}),
+
),
+
)
+
as _i7.Dio);
+
}
+
+
/// A class which mocks [FlutterSecureStorage].
+
///
+
/// See the documentation for Mockito's code generation for more information.
+
class MockFlutterSecureStorage extends _i1.Mock
+
implements _i8.FlutterSecureStorage {
+
MockFlutterSecureStorage() {
+
_i1.throwOnMissingStub(this);
+
}
+
+
@override
+
_i8.IOSOptions get iOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#iOptions),
+
returnValue: _FakeIOSOptions_6(this, Invocation.getter(#iOptions)),
+
)
+
as _i8.IOSOptions);
+
+
@override
+
_i8.AndroidOptions get aOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#aOptions),
+
returnValue: _FakeAndroidOptions_7(
+
this,
+
Invocation.getter(#aOptions),
+
),
+
)
+
as _i8.AndroidOptions);
+
+
@override
+
_i8.LinuxOptions get lOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#lOptions),
+
returnValue: _FakeLinuxOptions_8(
+
this,
+
Invocation.getter(#lOptions),
+
),
+
)
+
as _i8.LinuxOptions);
+
+
@override
+
_i8.WindowsOptions get wOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#wOptions),
+
returnValue: _FakeWindowsOptions_9(
+
this,
+
Invocation.getter(#wOptions),
+
),
+
)
+
as _i8.WindowsOptions);
+
+
@override
+
_i8.WebOptions get webOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#webOptions),
+
returnValue: _FakeWebOptions_10(
+
this,
+
Invocation.getter(#webOptions),
+
),
+
)
+
as _i8.WebOptions);
+
+
@override
+
_i8.MacOsOptions get mOptions =>
+
(super.noSuchMethod(
+
Invocation.getter(#mOptions),
+
returnValue: _FakeMacOsOptions_11(
+
this,
+
Invocation.getter(#mOptions),
+
),
+
)
+
as _i8.MacOsOptions);
+
+
@override
+
void registerListener({
+
required String? key,
+
required _i11.ValueChanged<String?>? listener,
+
}) => super.noSuchMethod(
+
Invocation.method(#registerListener, [], {#key: key, #listener: listener}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterListener({
+
required String? key,
+
required _i11.ValueChanged<String?>? listener,
+
}) => super.noSuchMethod(
+
Invocation.method(#unregisterListener, [], {
+
#key: key,
+
#listener: listener,
+
}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterAllListenersForKey({required String? key}) =>
+
super.noSuchMethod(
+
Invocation.method(#unregisterAllListenersForKey, [], {#key: key}),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
void unregisterAllListeners() => super.noSuchMethod(
+
Invocation.method(#unregisterAllListeners, []),
+
returnValueForMissingStub: null,
+
);
+
+
@override
+
_i9.Future<void> write({
+
required String? key,
+
required String? value,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#write, [], {
+
#key: key,
+
#value: value,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<String?> read({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#read, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<String?>.value(),
+
)
+
as _i9.Future<String?>);
+
+
@override
+
_i9.Future<bool> containsKey({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#containsKey, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<bool>.value(false),
+
)
+
as _i9.Future<bool>);
+
+
@override
+
_i9.Future<void> delete({
+
required String? key,
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#delete, [], {
+
#key: key,
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<Map<String, String>> readAll({
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#readAll, [], {
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<Map<String, String>>.value(
+
<String, String>{},
+
),
+
)
+
as _i9.Future<Map<String, String>>);
+
+
@override
+
_i9.Future<void> deleteAll({
+
_i8.IOSOptions? iOptions,
+
_i8.AndroidOptions? aOptions,
+
_i8.LinuxOptions? lOptions,
+
_i8.WebOptions? webOptions,
+
_i8.MacOsOptions? mOptions,
+
_i8.WindowsOptions? wOptions,
+
}) =>
+
(super.noSuchMethod(
+
Invocation.method(#deleteAll, [], {
+
#iOptions: iOptions,
+
#aOptions: aOptions,
+
#lOptions: lOptions,
+
#webOptions: webOptions,
+
#mOptions: mOptions,
+
#wOptions: wOptions,
+
}),
+
returnValue: _i9.Future<void>.value(),
+
returnValueForMissingStub: _i9.Future<void>.value(),
+
)
+
as _i9.Future<void>);
+
+
@override
+
_i9.Future<bool?> isCupertinoProtectedDataAvailable() =>
+
(super.noSuchMethod(
+
Invocation.method(#isCupertinoProtectedDataAvailable, []),
+
returnValue: _i9.Future<bool?>.value(),
+
)
+
as _i9.Future<bool?>);
+
}
-23
test/services/vote_service_test.dart
···
});
});
-
group('ExistingVote', () {
-
test('should store direction and rkey', () {
-
const vote = ExistingVote(direction: 'up', rkey: 'abc123');
-
-
expect(vote.direction, 'up');
-
expect(vote.rkey, 'abc123');
-
});
-
});
-
-
group('VoteInfo', () {
-
test('should store vote info', () {
-
const info = VoteInfo(
-
direction: 'up',
-
voteUri: 'at://did:plc:test/social.coves.feed.vote/123',
-
rkey: '123',
-
);
-
-
expect(info.direction, 'up');
-
expect(info.voteUri, 'at://did:plc:test/social.coves.feed.vote/123');
-
expect(info.rkey, '123');
-
});
-
});
-
group('API Exception handling', () {
test('should throw ApiException on Dio network error', () {
final dioError = DioException(
+14 -42
test/services/vote_service_token_refresh_test.dart
···
expect(signOutCallCount, 0);
});
-
test('should handle 401 on vote delete and retry', () async {
-
const rkey = 'abc123';
-
-
// Mock will always return 401
-
dioAdapter.onPost(
-
'/xrpc/social.coves.feed.vote.delete',
-
(server) => server.reply(401, {
-
'error': 'Unauthorized',
-
'message': 'Token expired',
-
}),
-
data: {'rkey': rkey},
-
);
-
-
// Create vote with existing vote (will trigger delete)
-
expect(
-
() => voteService.createVote(
-
postUri: 'at://did:plc:test/social.coves.post.record/123',
-
postCid: 'bafy123',
-
direction: 'up',
-
existingVoteRkey: rkey,
-
existingVoteDirection: 'up',
-
),
-
throwsA(isA<Exception>()),
-
);
-
-
// Wait for async operations
-
await Future.delayed(const Duration(milliseconds: 100));
-
-
// Verify token refresh was called
-
expect(tokenRefreshCallCount, 1);
-
-
// Verify user was signed out after retry failed
-
expect(signOutCallCount, 1);
-
});
+
// Note: delete method was removed - backend handles toggle via create endpoint
test('should throw ApiException when session is null', () async {
// Create service that returns null session
···
sessionId: 'session123',
);
-
// Second request should use the new token
+
// Second request uses a different post
+
const postUri2 = 'at://did:plc:test/social.coves.post.record/456';
dioAdapter.onPost(
-
'/xrpc/social.coves.feed.vote.delete',
-
(server) => server.reply(200, {}),
-
data: {'rkey': 'xyz'},
+
'/xrpc/social.coves.feed.vote.create',
+
(server) => server.reply(200, {
+
'uri': 'at://did:plc:test/social.coves.feed.vote/abc',
+
'cid': 'bafy789',
+
}),
+
data: {
+
'subject': {'uri': postUri2, 'cid': postCid},
+
'direction': 'up',
+
},
);
-
// Make second request (delete vote)
+
// Make second request
await voteService.createVote(
-
postUri: postUri,
+
postUri: postUri2,
postCid: postCid,
direction: 'up',
-
existingVoteRkey: 'xyz',
-
existingVoteDirection: 'up',
);
// Verify no refresh was needed (tokens were valid)
+18 -9
test/test_helpers/mock_providers.dart
···
import 'package:coves_flutter/models/coves_session.dart';
import 'package:coves_flutter/providers/vote_provider.dart';
-
import 'package:coves_flutter/services/vote_service.dart';
import 'package:flutter/foundation.dart';
/// Mock AuthProvider for testing
···
notifyListeners();
}
-
void loadInitialVotes(Map<String, VoteInfo> votes) {
-
for (final entry in votes.entries) {
-
final postUri = entry.key;
-
final voteInfo = entry.value;
+
void setInitialVoteState({
+
required String postUri,
+
String? voteDirection,
+
String? voteUri,
+
}) {
+
if (voteDirection != null) {
+
String? rkey;
+
if (voteUri != null) {
+
final parts = voteUri.split('/');
+
if (parts.isNotEmpty) {
+
rkey = parts.last;
+
}
+
}
_votes[postUri] = VoteState(
-
direction: voteInfo.direction,
-
uri: voteInfo.voteUri,
-
rkey: voteInfo.rkey,
+
direction: voteDirection,
+
uri: voteUri,
+
rkey: rkey,
deleted: false,
);
_scoreAdjustments.remove(postUri);
+
} else {
+
_votes.remove(postUri);
}
-
notifyListeners();
}
void clear() {