Source publiée
Télécharger la source ZIP
CH-J SM Mobile
Parcourez les répertoires et les fichiers pour une version spécifique de l'application.
CH-J / SM Mobile
134 fichiers
sm-mobile-20261016T050549Z-3678f2a05fa9
Ajouté: · Construit:
1
import 'dart:convert';2
import 'package:flutter/material.dart';3
import 'package:flutter_test/flutter_test.dart';4
import 'package:sm_mobile/core/app_controller.dart';5
import 'package:sm_mobile/core/failure.dart';6
import 'package:sm_mobile/services/legal.dart';7
import 'support.dart';9
void main() {10
TestWidgetsFlutterBinding.ensureInitialized();11
test(12
'license consent binds exact build, license and displayed guidance',13
() async {14
final store = MemoryStore();15
final legal = Legal(store);16
expect(await legal.load(), false);17
await expectLater(18
legal.accept(guidanceDisplayed: false),19
throwsA(isA<Failure>()),20
);21
await legal.accept(guidanceDisplayed: true);22
expect(await Legal(store).load(), true);23
final record = jsonDecode(store.values['consent']!);24
record['identity'] = 'different-build-same-version';25
store.values['consent'] = jsonEncode(record);26
expect(await Legal(store).load(), false);27
},28
);29
test('Vault cannot initialize before explicit license acceptance', () async {30
final c = AppController(MemoryStore());31
await c.initialize();32
await expectLater(33
c.openVault('valid master password', create: true),34
throwsA(isA<Failure>()),35
);36
expect(await c.vault.exists(), false);37
c.dispose();38
});39
test(40
'background cancels Vault initialization and invalidates pending work',41
() async {42
final c = AppController(MemoryStore());43
await c.initialize();44
await c.acceptLicense();45
final opening = c.openVault(46
'valid background master password',47
create: true,48
);49
c.didChangeAppLifecycleState(AppLifecycleState.paused);50
await expectLater(opening, throwsA(isA<Failure>()));51
expect(c.vault.unlocked, false);52
expect(c.ssh.connected, false);53
c.dispose();54
},55
);56
}SHA-256
b6c6bea214973a3b8d248dde7fb248eed8fcff544b402f7b6d41b62f77338908CH-J Proprietary Software License 1.14 · La source est fournie sous CH-J Proprietary Software License 1.14. Sa disponibilité ne modifie pas les termes de la licence ni n'accorde de droits supplémentaires.
Archive SHA-256
c486a807e4828998b9c57ab0f2e760f7980b31965fe118e89d3e1a5a2b65be65