Skip to content

Commit 3b573d2

Browse files
author
Hack.bg R&D
committed
fix(test): use ElementsRegtest.Test
1 parent 92fd9c9 commit 3b573d2

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type Bitcoin from '../../Bitcoin/index.ts';
22
import Fn from '../../../library/Fn.ts';
33
import { Log } from '../../../library/Log.ts';
4-
import { Num, Base16 } from '../../../library/Number.ts';
4+
import { Num, Base16 } from '../../../library/Num.ts';
55
import process from 'node:process';
66

77
import type {

src/test.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env -S deno run --allow-read --allow-env --allow-run --allow-write=/tmp/fadroma --allow-import=cdn.skypack.dev:443,deno.land:443 --allow-net=127.0.0.1:8941,liquidtestnet.com:443,blockstream.info:443
22
import { deepStrictEqual as equal, rejects, throws, ok } from 'node:assert';
33
import { Base16, Fn, Test, Run, sleep } from '../../../library/index.ts';
4-
import Btc, { BtcRpc, LiquidTestnet, ElementsRegtest } from '../../Bitcoin/index.ts';
5-
import { SendFromWallet, AssertBalance } from '../../Bitcoin/test.ts';
4+
import Btc, { Rpc, LiquidTestnet, ElementsRegtest } from '../../Bitcoin/index.ts';
65
import { Signer, Program, Wasm, Arg, Args } from './sdk.ts';
76
const { is, has } = Test;
8-
const { CreateWallet, Rescan } = BtcRpc;
9-
const { INITIAL_COINS, BITCOIN } = ElementsRegtest;
107
const { sendSigned, keypair } = await Wasm();
118

129
const SIGNER = await Signer(new Uint8Array(Array(32).fill(1)));
@@ -41,17 +38,9 @@ export function TestOnTestnet () {
4138
}
4239

4340
export function TestOnLocalnet () {
44-
/** When starting the localnet, the genesis balance is not indexed. */
45-
const BALANCE_EMPTY = { bitcoin: 0 };
46-
/** After RPC rescanblockchain, it shoud look like this. */
47-
const BALANCE_INITIAL = { [ElementsRegtest.ASSETS.REISSUE]: 1, bitcoin: Number(INITIAL_COINS / BITCOIN) };
4841
// Tests that run on temporary localnet:
49-
return Test('elementsregtest',
50-
() => ElementsRegtest({ debugs: false, debugexclude: ['libevent'] }),
51-
Run.Verbose(true), // Pipe the localnet's output to stderr
52-
CreateWallet('test-simf', AssertBalance(BALANCE_EMPTY)),
53-
Rescan(AssertBalance(BALANCE_INITIAL)),
54-
SendFromWallet("100000", 8), // Fund deployer (non-secret key 8) from genesis wallet
42+
return ElementsRegtest.Test({},
43+
Rpc.SendFromWallet("100000", 8), // Fund deployer (non-secret key 8) from genesis wallet
5544
TestSend(), // Test the basic transaction primitive
5645
Test('Programs', // Test SimplicityHL commitment and redemption transactions.
5746
// Empty program, always passes:

0 commit comments

Comments
 (0)