Skip to content

Commit

Permalink
refactor: simplify io in quick-load.test
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Oct 24, 2024
1 parent f0551b9 commit 0d0ffef
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions a3p-integration/proposals/d:quick-send/quick-load.test.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
// @ts-check
/* global globalThis */
import anyTest from 'ava';
import test from 'ava';
import { extractStreamCellValue } from '@agoric/synthetic-chain';
import { localAPI, makeLCD } from './test-lib/cosmos-api.js';
import { makeVStorage } from './test-lib/vstorage-client.js';

/**
* @import {TestFn} from 'ava';
*/
/** @type {TestFn<Awaited<ReturnType<typeof makeTestContext>>>} */
// @ts-expect-error XXX something weird about test.after
const test = anyTest;

const makeTestContext = async t => {
const api = makeLCD(localAPI, { fetch: globalThis.fetch });
return { api };
};

test.before('IO setup', async t => (t.context = await makeTestContext(t)));
const io = { api: makeLCD(localAPI, { fetch: globalThis.fetch }) };

test('quickSend is in agoricNames.instance', async t => {
const { api } = t.context;
const vs = makeVStorage(api);
const vs = makeVStorage(io.api);
const data = await vs.readStorage('published.agoricNames.instance');
const value = extractStreamCellValue(data);
assert.typeof(value, 'string');
const capData = JSON.parse(value);
const encoding = JSON.parse(capData?.body.replace(/^#/, ''));
const byName = Object.fromEntries(encoding);
Expand Down

0 comments on commit 0d0ffef

Please sign in to comment.