stash_test 4.1.0 copy "stash_test: ^4.1.0" to clipboard
stash_test: ^4.1.0 copied to clipboard

outdated

Provides the testing support needed in order to implement extensions to the base stash package

example/example.md

import 'package:stash_custom/stash_custom.dart';
import 'package:stash_test/stash_test.dart';

class VaultStoreContext extends VaultTestContext<CustomVaultStore> {
  VaultStoreContext(ValueGenerator generator,
      {dynamic Function(Map<String, dynamic>)? fromEncodable})
      : super(generator, fromEncodable: generator.fromEncodable);

  Future<CustomVaultStore> _newCustomStore() {
    return Future.value(newCustomVaultStore(fromEncodable: fromEncodable));
  }

  @override
  Future<CustomVaultStore> newStore() {
    return _newCustomStore();
  }
}

class CacheStoreContext extends CacheTestContext<CustomCacheStore> {
  CacheStoreContext(ValueGenerator generator,
      {dynamic Function(Map<String, dynamic>)? fromEncodable})
      : super(generator, fromEncodable: generator.fromEncodable);

  Future<CustomCacheStore> _newCustomStore() {
    return Future.value(newCustomCacheStore(fromEncodable: fromEncodable));
  }

  @override
  Future<CustomCacheStore> newStore() {
    return _newCustomStore();
  }
}

void main() async {
  testStore((generator) => VaultStoreContext(generator));
  testStore((generator) => CacheStoreContext(generator));
  testVault((generator) => VaultStoreContext(generator));
  testCache((generator) => CacheStoreContext(generator));
}

0
likes
0
pub points
27%
popularity

Publisher

verified publisherivoleitao.dev

Provides the testing support needed in order to implement extensions to the base stash package

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

clock, equatable, stash, test, time

More

Packages that depend on stash_test