mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-10 18:07:03 +01:00
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
28 lines
906 B
Dart
28 lines
906 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:todo/attachments/image_password_store.dart';
|
|
|
|
import '../fake_secure_storage.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
const store = ImagePasswordStore();
|
|
|
|
test('write, read, login and delete', () async {
|
|
installFakeSecureStorage();
|
|
expect(await store.read(), '');
|
|
expect(await store.login(), isNull);
|
|
expect(await store.write('pw'), isTrue);
|
|
expect(await store.read(), 'pw');
|
|
final login = (await store.login())!;
|
|
expect((login.user, login.password), (kDufsImagesUser, 'pw'));
|
|
expect(await store.write(''), isTrue);
|
|
expect(await store.read(), '');
|
|
});
|
|
|
|
test('a missing keystore reads as no password and refuses writes', () async {
|
|
installFakeSecureStorage(throwing: true);
|
|
expect(await store.read(), '');
|
|
expect(await store.write('pw'), isFalse);
|
|
});
|
|
}
|