fix: improve transfer recognition and local data safety

This commit is contained in:
2026-07-26 21:36:46 +08:00
parent 7df25edd96
commit 882293343e
21 changed files with 505 additions and 128 deletions
+24
View File
@@ -1,12 +1,36 @@
import 'dart:convert';
import 'package:flutter_test/flutter_test.dart';
import 'package:miaoji_zhang/shared/api/backend_identity.dart';
import 'package:miaoji_zhang/shared/api/business_api.dart';
import 'package:miaoji_zhang/shared/api/sse_frame_accumulator.dart';
import 'package:miaoji_zhang/shared/services/current_ledger_store.dart';
import 'package:miaoji_zhang/shared/widgets/app_icons.dart';
void main() {
test('本地账号命名空间同时隔离后端和用户', () {
final first = BackendIdentity.accountNamespaceFor(
'https://api-a.example.com/',
1,
);
final normalized = BackendIdentity.accountNamespaceFor(
'https://API-A.example.com',
1,
);
final otherBackend = BackendIdentity.accountNamespaceFor(
'https://api-b.example.com',
1,
);
final otherUser = BackendIdentity.accountNamespaceFor(
'https://api-a.example.com',
2,
);
expect(first, normalized);
expect(first, isNot(otherBackend));
expect(first, isNot(otherUser));
});
test(
'SSE framing preserves split UTF-8 characters and trailing events',
() async {