super_cache_testing library
Test utilities for super_cache.
Provides FakeCache and ManualClock for writing deterministic unit tests
that cover TTL expiration without relying on Future.delayed.
import 'package:super_cache_testing/super_cache_testing.dart';
final clock = ManualClock();
final cache = FakeCache<String, int>(clock: clock);
cache.put('score', 42, ttl: const Duration(minutes: 5));
clock.advance(const Duration(minutes: 6));
expect(cache.get('score'), isNull); // expired
Classes
-
FakeCache<
K, V> -
An in-memory
Cacheimplementation for unit tests. - ManualClock
- A manually-controlled clock for deterministic TTL testing.