fc4a4792c3
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 3fff318bbe66a5f4387c25d18e0d2a9480719d72)
46 lines
1.2 KiB
Dart
46 lines
1.2 KiB
Dart
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:tmail_ui_user/features/login/data/extensions/list_account_cache_extensions.dart';
|
|
import 'package:tmail_ui_user/features/login/data/model/account_cache.dart';
|
|
|
|
void main() {
|
|
group('AccountCache test', () {
|
|
test('removeDuplicated should remove duplicate accountId', () async {
|
|
final account1 = AccountCache(
|
|
'1',
|
|
'oidc',
|
|
isSelected: true,
|
|
accountId: '1',
|
|
userName: '1',
|
|
apiUrl: 'https://example.com/jmap'
|
|
);
|
|
final account2 = AccountCache(
|
|
'2',
|
|
'oidc',
|
|
isSelected: true,
|
|
accountId: '1',
|
|
userName: '1',
|
|
apiUrl: 'https://example.com/jmap'
|
|
);
|
|
final account3 = AccountCache(
|
|
'3',
|
|
'basic',
|
|
isSelected: true,
|
|
accountId: '2',
|
|
userName: '2',
|
|
apiUrl: 'https://example.com/jmap'
|
|
);
|
|
final account4 = AccountCache(
|
|
'4',
|
|
'basic',
|
|
isSelected: true,
|
|
accountId: '2',
|
|
userName: '2',
|
|
apiUrl: 'https://example.com/jmap'
|
|
);
|
|
|
|
final result = [account1, account2, account3, account4].removeDuplicated();
|
|
expect(result, equals([account1, account3]));
|
|
});
|
|
});
|
|
} |