CH-J Tools Mobile透過 SSH 管理伺服器
選單
已發布的原始碼

CH-J Tools Mobile

瀏覽特定應用程式版本的目錄與檔案。

下載原始碼 ZIP
CH-J / CH-J Tools Mobile 175 個檔案
sm-mobile-20261016T185235Z-8e93ecc1b59a 新增時間: · 建置時間:
legal_lifecycle_test.dart 新增時間: 未記錄日期 1.8 KB · 56 行
程式碼 下載檔案
1import 'dart:convert';
2import 'package:flutter/material.dart';
3import 'package:flutter_test/flutter_test.dart';
4import 'package:sm_mobile/core/app_controller.dart';
5import 'package:sm_mobile/core/failure.dart';
6import 'package:sm_mobile/services/legal.dart';
7import 'support.dart';
9void 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 );
SHA-256b6c6bea214973a3b8d248dde7fb248eed8fcff544b402f7b6d41b62f77338908

CH-J Proprietary Software License 1.14 · 原始碼依 CH-J Proprietary Software License 1.14 提供。公開原始碼不會改變授權條款,也不會授予額外的權利。

壓縮檔 SHA-25646e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655
檔案