Merge pull request #215 from cypherstack/cryptonote/hive-test

Use Hive test adapter for Monero and Wownero tests
This commit is contained in:
julian-CStack 2022-11-10 12:43:07 -06:00 committed by GitHub
commit 8eece2b9b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 16 deletions

View file

@ -23,6 +23,7 @@ jobs:
run: |
cargo install cargo-ndk
rustup target add x86_64-unknown-linux-gnu
sudo apt update
sudo apt install -y unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jre-headless libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm
sudo apt install -y debhelper libclang-dev cargo rustc opencl-headers libssl-dev ocl-icd-opencl-dev
sudo apt install -y libc6-dev-i386

View file

@ -81,19 +81,29 @@ void main() async {
if (Platform.isIOS) {
appDir = (await getLibraryDirectory());
}
await Hive.close();
Hive.init(appDir.path);
Hive.registerAdapter(NodeAdapter());
Hive.registerAdapter(WalletInfoAdapter());
Hive.registerAdapter(WalletTypeAdapter());
Hive.registerAdapter(UnspentCoinsInfoAdapter());
monero.onStartup();
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
walletService = monero.createMoneroWalletService(_walletInfoSource);
bool hiveAdaptersRegistered = false;
group("Mainnet tests", () {
setUp(() async {
await setUpTestHive();
if (!hiveAdaptersRegistered) {
hiveAdaptersRegistered = true;
Hive.registerAdapter(NodeAdapter());
Hive.registerAdapter(WalletInfoAdapter());
Hive.registerAdapter(WalletTypeAdapter());
Hive.registerAdapter(UnspentCoinsInfoAdapter());
final wallets = await Hive.openBox('wallets');
await wallets.put('currentWalletName', name);
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
walletService = monero.createMoneroWalletService(_walletInfoSource);
}
try {
// if (name?.isEmpty ?? true) {
// name = await generateName();

View file

@ -72,19 +72,29 @@ void main() async {
if (Platform.isIOS) {
appDir = (await getLibraryDirectory());
}
await Hive.close();
Hive.init(appDir.path);
Hive.registerAdapter(NodeAdapter());
Hive.registerAdapter(WalletInfoAdapter());
Hive.registerAdapter(WalletTypeAdapter());
Hive.registerAdapter(UnspentCoinsInfoAdapter());
wownero.onStartup();
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
walletService = wownero.createWowneroWalletService(_walletInfoSource);
bool hiveAdaptersRegistered = false;
group("Wownero 14 word seed generation", () {
setUp(() async {
await setUpTestHive();
if (!hiveAdaptersRegistered) {
hiveAdaptersRegistered = true;
Hive.registerAdapter(NodeAdapter());
Hive.registerAdapter(WalletInfoAdapter());
Hive.registerAdapter(WalletTypeAdapter());
Hive.registerAdapter(UnspentCoinsInfoAdapter());
final wallets = await Hive.openBox('wallets');
await wallets.put('currentWalletName', name);
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
walletService = wownero.createWowneroWalletService(_walletInfoSource);
}
bool hasThrown = false;
try {
name = 'namee${Random().nextInt(10000000)}';