Skip to content

Commit

Permalink
fixup! test: common setup
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Jun 11, 2024
1 parent d758cb1 commit c10089c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
6 changes: 3 additions & 3 deletions multichain-testing/test/smart-wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { commonSetup, SetupContextWithWallets } from './support.js';

const test = anyTest as TestFn<SetupContextWithWallets>;

test.before(async (t) => {
test.before(async t => {
const { setupTestKeys, ...rest } = await commonSetup(t);
const wallets = await setupTestKeys();
t.context = { ...rest, wallets };
});

test.after(async (t) => {
test.after(async t => {
const { deleteTestKeys } = t.context;
await deleteTestKeys();
});

test('provision smart wallet', async (t) => {
test('provision smart wallet', async t => {
const { wallets, provisionSmartWallet, makeQueryTool, useChain } = t.context;

const wallet = await provisionSmartWallet(wallets.user1, { BLD: 100n });
Expand Down
8 changes: 2 additions & 6 deletions multichain-testing/test/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ import { generateMnemonic } from '../tools/wallet.js';
const setupRegistry = makeSetupRegistry(makeGetConfigFile({ dirname, join }));

const makeAgdTools = async (t: ExecutionContext) => {
const bundleCache = await makeNodeBundleCache(
'bundles',
{},
(s) => import(s),
);
const bundleCache = await makeNodeBundleCache('bundles', {}, s => import(s));
const { writeFile } = ambientFsp;
const { execFileSync, execFile } = ambientChildProcess;
const tools = await makeE2ETools(t, bundleCache, {
Expand Down Expand Up @@ -43,7 +39,7 @@ const makeKeyring = async (
};

const deleteTestKeys = () =>
Promise.all(_keys.map((key) => e2eTools.deleteKey(key)));
Promise.all(_keys.map(key => e2eTools.deleteKey(key)));

return { setupTestKeys, deleteTestKeys };
};
Expand Down
4 changes: 2 additions & 2 deletions multichain-testing/test/tools/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { commonSetup } from '../support.js';

const test = anyTest as TestFn<Record<string, never>>;

test('assets can be retrieved from config', async (t) => {
test('assets can be retrieved from config', async t => {
const { useChain } = await commonSetup(t);

t.like(useChain('osmosis').chainInfo.nativeAssetList.assets, [
Expand All @@ -23,7 +23,7 @@ test('assets can be retrieved from config', async (t) => {
]);
});

test('staking info can be retrieved from config', async (t) => {
test('staking info can be retrieved from config', async t => {
const { useChain } = await commonSetup(t);

t.like(useChain('osmosis').chain.staking, {
Expand Down
2 changes: 1 addition & 1 deletion multichain-testing/test/tools/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { commonSetup } from '../support.js';

const test = anyTest as TestFn<Record<string, never>>;

test('create a wallet and get tokens', async (t) => {
test('create a wallet and get tokens', async t => {
const { useChain } = await commonSetup(t);

const prefix = useChain('osmosis').chain.bech32_prefix;
Expand Down
2 changes: 1 addition & 1 deletion multichain-testing/tools/sleep.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LogFn } from 'ava';

export const sleep = (ms: number, log?: LogFn) =>
new Promise((resolve) => {
new Promise(resolve => {
if (log) log(`Sleeping for ${ms}ms...`);
setTimeout(resolve, ms);
});

0 comments on commit c10089c

Please sign in to comment.