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');
  });
}
