tane/apps/app_seeds/test/services/profile_cache_test.dart
vjrj 48228c0bc6 feat(block2): show contact names (resolve peers' published profiles)
Closes the profile loop — peers now appear by name, not a raw key.
- ProfileCache: keystore-backed cache of peers' published display names (works
  offline) + shortPubkey() fallback.
- Chat: the app bar shows the peer's name (cached first, then freshened from
  their kind:0 over the session); falls back to a short key.
- Inbox: each conversation shows the cached name, and missing names are resolved
  over one session and cached.
- Wired via DI + TaneApp(profileCache).

Analyzer clean; ProfileCache covered by a plain test.
2026-07-10 12:47:48 +02:00

22 lines
713 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:tane/services/profile_cache.dart';
import '../support/test_support.dart';
void main() {
test('unknown pubkey has no cached name', () async {
final cache = ProfileCache(InMemorySecretStore());
expect(await cache.name('abc'), isNull);
});
test('setName then name round-trips (trimmed)', () async {
final cache = ProfileCache(InMemorySecretStore());
await cache.setName('abc', ' Alicia ');
expect(await cache.name('abc'), 'Alicia');
});
test('shortPubkey abbreviates long keys, keeps short ones', () {
expect(shortPubkey('abcdef1234567890'), 'abcdef…7890');
expect(shortPubkey('short'), 'short');
});
}