fix: Make transactions atomic / AutoLogout
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:kooltab2/app/app_lifecycle_lock.dart';
|
||||
|
||||
void main() {
|
||||
test('locks when the app is no longer active', () {
|
||||
var lockCount = 0;
|
||||
final observer = AppLifecycleLockObserver(onLock: () => lockCount++);
|
||||
|
||||
for (final state in [
|
||||
AppLifecycleState.inactive,
|
||||
AppLifecycleState.hidden,
|
||||
AppLifecycleState.paused,
|
||||
AppLifecycleState.detached,
|
||||
]) {
|
||||
observer.didChangeAppLifecycleState(state);
|
||||
}
|
||||
|
||||
expect(lockCount, 4);
|
||||
});
|
||||
|
||||
test('does not lock while the app is active', () {
|
||||
var lockCount = 0;
|
||||
final observer = AppLifecycleLockObserver(onLock: () => lockCount++);
|
||||
|
||||
observer.didChangeAppLifecycleState(AppLifecycleState.resumed);
|
||||
|
||||
expect(lockCount, 0);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user