stash_test library

Provides testing support to third party extensions

Classes

BoolGenerator
A bool implementation of a ValueGenerator which produces a bool from a provided seed
CacheTestContext<T extends Store<CacheInfo, CacheEntry>>
Base class for all the cache test contexts.
ContainerClass
A container class used to test class serialization / deserialization scenarios
ContainerClassGenerator
A ValueClass implementation of a ValueGenerator which produces a ValueClass from a provided seed
DoubleGenerator
A double implementation of a ValueGenerator which produces a double from a provided seed
EntryGenerator<I extends Info, E extends Entry<I>>
IntGenerator
A int implementation of a ValueGenerator which produces a int from a provided seed
IteratorGenerator
A Iterator implementation of a ValueGenerator which produces a Iterator from a provided seed and a element ValueGenerator
MapGenerator
A Map implementation of a ValueGenerator which produces a Map from a provided seed
StringGenerator
A String implementation of a ValueGenerator which produces a String from a provided seed and a optional prefix
TestContext<I extends Info, E extends Entry<I>, T extends Store<I, E>>
Base class for all the test contexts.
ValueClass
A value class used to test class serialization / deserialization scenarios
ValueClassGenerator
A ValueClass implementation of a ValueGenerator which produces a ValueClass from a provided seed
ValueGenerator
Generic definition of a value generator
VaultTestContext<T extends Store<VaultInfo, VaultEntry>>
Base class for all the vault test contexts.

Enums

CacheTest
The supported cache tests
StoreTest
The supported store tests
TypeTest
The range of supported type tests
VaultTest
The supported vault tests

Extensions

TypeTestValue on TypeTest

Properties

allTypeTests Map<TypeTest, ValueGenerator Function()>
All type tests
getter/setter pair
defaultStashTypeTests Map<TypeTest, ValueGenerator Function()>
Default stash type tests
getter/setter pair
defaultStoreTypeTests Map<TypeTest, ValueGenerator Function()>
Default store type tests
getter/setter pair

Functions

check<I extends Info, E extends Entry<I>, T extends Store<I, E>>(TestContext<I, E, T> ctx, dynamic actual, dynamic matcher, String reason) → void
Assert that actual matches matcher in a specific test ctx.
newGenericCache<V, T extends Store<CacheInfo, CacheEntry>>(T store, {String? name, dynamic fromEncodable(Map<String, dynamic>)?, ExpiryPolicy? expiryPolicy, KeySampler? sampler, EvictionPolicy? evictionPolicy, int? maxEntries, CacheLoader<V>? cacheLoader, Clock? clock, EventListenerMode? eventListenerMode, bool? statsEnabled, CacheStats? stats}) Future<Cache<V>>
Creates a new GenericCache bound to an implementation of the Store interface
newGenericVault<V, T extends Store<VaultInfo, VaultEntry>>(T store, {String? name, dynamic fromEncodable(Map<String, dynamic>)?, VaultLoader<V>? vaultLoader, Clock? clock, EventListenerMode? eventListenerMode, bool? statsEnabled, VaultStats? stats}) Future<Vault<V>>
Creates a Vault bound to an implementation of the Store interface
newStore<I extends Info, E extends Entry<I>, T extends Store<I, E>>(TestContext<I, E, T> ctx) Future<T>
Creates a new store
testCache<T extends Store<CacheInfo, CacheEntry>>(CacheTestContextBuilder<T> newCacheTestContext, {Map<TypeTest, Function>? types, Set<CacheTest> cacheTests = _cacheTests}) → void
Default cache test
testCacheWith<T extends Store<CacheInfo, CacheEntry>>(CacheTestContext<T> ctx, {Set<CacheTest> cacheTests = _cacheTests}) Future<void>
Entry point for the cache testing harness. It delegates most of the construction to user provided functions that are responsible for the Store creation, the Cache creation and by the generation of testing values (with a provided ValueGenerator instance). They are encapsulated in provided CacheTestContext object
testStore<I extends Info, E extends Entry<I>, T extends Store<I, E>>(TestContextBuilder<I, E, T> newTestContext, {Map<TypeTest, Function>? types, Set<StoreTest> tests = _storeTests}) → void
Default store test
testStoreWith<I extends Info, E extends Entry<I>, T extends Store<I, E>>(TestContext<I, E, T> ctx, {Set<StoreTest> tests = _storeTests}) Future<void>
Entry point for the store testing harness. It delegates most of the construction to user provided functions that are responsible for the Store creation, and the generation of testing values (with a provided ValueGenerator instance). They are encapsulated in provided TestContext object
testVault<T extends Store<VaultInfo, VaultEntry>>(VaultTestContextBuilder<T> newVaultTestContext, {Map<TypeTest, Function>? types, Set<VaultTest> vaultTests = _vaultTests}) → void
Default vault test
testVaultWith<T extends Store<VaultInfo, VaultEntry>>(VaultTestContext<T> ctx, {Set<VaultTest> vaultTests = _vaultTests}) Future<void>
Entry point for the vault testing harness. It delegates most of the construction to user provided functions that are responsible for the Store creation, the Vault creation and by the generation of testing values (with a provided ValueGenerator instance). They are encapsulated in provided VaultTestContext object

Typedefs

CacheBuilder<T extends Store<CacheInfo, CacheEntry>> = GenericCache Function(T store, {CacheLoader cacheLoader, Clock clock, EvictionPolicy evictionPolicy, ExpiryPolicy expiryPolicy, int maxEntries, String name, KeySampler sampler})
Cache builder function
CacheTestContextBuilder<T extends Store<CacheInfo, CacheEntry>> = CacheTestContext<T> Function(ValueGenerator generator)
CacheTestContext builder function
StoreBuilder<I extends Info, E extends Entry<I>, T extends Store<I, E>> = Future<T> Function()
Store builder function
TestContextBuilder<I extends Info, E extends Entry<I>, T extends Store<I, E>> = TestContext<I, E, T> Function(ValueGenerator generator)
TestContext builder function
VaultTestContextBuilder<T extends Store<VaultInfo, VaultEntry>> = VaultTestContext<T> Function(ValueGenerator generator)
VaultTestContext builder function