chore: bump line length to 120 (#20191)

This commit is contained in:
shenlong
2025-07-25 08:07:22 +05:30
committed by GitHub
parent 977c9b96ba
commit ad65e9011a
517 changed files with 4520 additions and 9514 deletions
@@ -29,10 +29,8 @@ void main() {
);
registerFallbackValue(UserStub.admin);
when(() => mockStoreService.get(StoreKey.currentUser))
.thenReturn(UserStub.admin);
when(() => mockStoreService.tryGet(StoreKey.currentUser))
.thenReturn(UserStub.admin);
when(() => mockStoreService.get(StoreKey.currentUser)).thenReturn(UserStub.admin);
when(() => mockStoreService.tryGet(StoreKey.currentUser)).thenReturn(UserStub.admin);
});
group('getMyUser', () {
@@ -42,8 +40,7 @@ void main() {
});
test('should handle user not found scenario', () {
when(() => mockStoreService.get(StoreKey.currentUser))
.thenThrow(Exception('User not found'));
when(() => mockStoreService.get(StoreKey.currentUser)).thenThrow(Exception('User not found'));
expect(() => sut.getMyUser(), throwsA(isA<Exception>()));
});
@@ -56,8 +53,7 @@ void main() {
});
test('should return null if user not found', () {
when(() => mockStoreService.tryGet(StoreKey.currentUser))
.thenReturn(null);
when(() => mockStoreService.tryGet(StoreKey.currentUser)).thenReturn(null);
final result = sut.tryGetMyUser();
expect(result, isNull);
});
@@ -65,15 +61,13 @@ void main() {
group('watchMyUser', () {
test('should return user stream from store', () {
when(() => mockStoreService.watch(StoreKey.currentUser))
.thenAnswer((_) => Stream.value(UserStub.admin));
when(() => mockStoreService.watch(StoreKey.currentUser)).thenAnswer((_) => Stream.value(UserStub.admin));
final result = sut.watchMyUser();
expect(result, emits(UserStub.admin));
});
test('should return an empty stream if user not found', () {
when(() => mockStoreService.watch(StoreKey.currentUser))
.thenAnswer((_) => const Stream.empty());
when(() => mockStoreService.watch(StoreKey.currentUser)).thenAnswer((_) => const Stream.empty());
final result = sut.watchMyUser();
expect(result, emitsInOrder([]));
});
@@ -81,16 +75,12 @@ void main() {
group('refreshMyUser', () {
test('should return user from api and store it', () async {
when(() => mockUserApiRepo.getMyUser())
.thenAnswer((_) async => UserStub.admin);
when(() => mockStoreService.put(StoreKey.currentUser, UserStub.admin))
.thenAnswer((_) async => true);
when(() => mockUserRepo.update(UserStub.admin))
.thenAnswer((_) async => UserStub.admin);
when(() => mockUserApiRepo.getMyUser()).thenAnswer((_) async => UserStub.admin);
when(() => mockStoreService.put(StoreKey.currentUser, UserStub.admin)).thenAnswer((_) async => true);
when(() => mockUserRepo.update(UserStub.admin)).thenAnswer((_) async => UserStub.admin);
final result = await sut.refreshMyUser();
verify(() => mockStoreService.put(StoreKey.currentUser, UserStub.admin))
.called(1);
verify(() => mockStoreService.put(StoreKey.currentUser, UserStub.admin)).called(1);
verify(() => mockUserRepo.update(UserStub.admin)).called(1);
expect(result, UserStub.admin);
});
@@ -110,8 +100,7 @@ void main() {
group('createProfileImage', () {
test('should return profile image path', () async {
const profileImagePath = 'profile.jpg';
final updatedUser =
UserStub.admin.copyWith(profileImagePath: profileImagePath);
final updatedUser = UserStub.admin.copyWith(profileImagePath: profileImagePath);
when(
() => mockUserApiRepo.createProfileImage(
@@ -119,24 +108,19 @@ void main() {
data: Uint8List(0),
),
).thenAnswer((_) async => profileImagePath);
when(() => mockStoreService.put(StoreKey.currentUser, updatedUser))
.thenAnswer((_) async => true);
when(() => mockUserRepo.update(updatedUser))
.thenAnswer((_) async => UserStub.admin);
when(() => mockStoreService.put(StoreKey.currentUser, updatedUser)).thenAnswer((_) async => true);
when(() => mockUserRepo.update(updatedUser)).thenAnswer((_) async => UserStub.admin);
final result =
await sut.createProfileImage(profileImagePath, Uint8List(0));
final result = await sut.createProfileImage(profileImagePath, Uint8List(0));
verify(() => mockStoreService.put(StoreKey.currentUser, updatedUser))
.called(1);
verify(() => mockStoreService.put(StoreKey.currentUser, updatedUser)).called(1);
verify(() => mockUserRepo.update(updatedUser)).called(1);
expect(result, profileImagePath);
});
test('should return null if profile image creation fails', () async {
const profileImagePath = 'profile.jpg';
final updatedUser =
UserStub.admin.copyWith(profileImagePath: profileImagePath);
final updatedUser = UserStub.admin.copyWith(profileImagePath: profileImagePath);
when(
() => mockUserApiRepo.createProfileImage(
@@ -145,8 +129,7 @@ void main() {
),
).thenThrow(Exception('Failed to create profile image'));
final result =
await sut.createProfileImage(profileImagePath, Uint8List(0));
final result = await sut.createProfileImage(profileImagePath, Uint8List(0));
verifyNever(
() => mockStoreService.put(StoreKey.currentUser, updatedUser),
);