@bsv/wallet-toolbox
Version:
BRC100 conforming wallet, wallet storage and wallet signer components
64 lines • 2.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-unused-vars */
const index_all_1 = require("../../../src/index.all");
const TestUtilsWalletStorage_1 = require("../../utils/TestUtilsWalletStorage");
/**
* WARNING: This test hangs the commit to master automated test run cycle if included in regular tests...
*/
describe('walletStorageClient test', () => {
jest.setTimeout(99999999);
const env = TestUtilsWalletStorage_1._tu.getEnv('test');
const testName = () => expect.getState().currentTestName || 'test';
const ctxs = [];
beforeAll(async () => {
//_tu.mockPostServicesAsSuccess(ctxs)
});
afterAll(async () => {
for (const ctx of ctxs) {
await ctx.storage.destroy();
}
});
test('1 backup to client', async () => {
const ctx = await TestUtilsWalletStorage_1._tu.createLegacyWalletSQLiteCopy('walletStorageClient1');
ctxs.push(ctx);
const { wallet, storage } = ctx;
{
const client = new index_all_1.StorageClient(wallet, 'https://staging-storage.babbage.systems');
await storage.addWalletStorageProvider(client);
await storage.updateBackups();
}
});
test('2 create storage client backup for test wallet', async () => {
const ctx = await TestUtilsWalletStorage_1._tu.createTestWalletWithStorageClient({
rootKeyHex: '1'.repeat(64),
endpointUrl: 'https://staging-storage.babbage.systems'
});
ctxs.push(ctx);
const { wallet, storage } = ctx;
{
const auth = await storage.getAuth();
expect(auth.userId).toBeTruthy();
}
});
test('3 create storage client backup for main wallet', async () => {
const filePath = process.env.MY_MAIN_FILEPATH;
const identityKey = process.env.MY_MAIN_IDENTITY || '';
const rootKeyHex = env.devKeys[identityKey];
expect(filePath && identityKey && rootKeyHex);
const chain = 'main';
const main = await TestUtilsWalletStorage_1._tu.createSQLiteTestWallet({
filePath,
databaseName: 'tone42',
chain,
rootKeyHex
});
ctxs.push(main);
{
const client = new index_all_1.StorageClient(main.wallet, 'https://storage.babbage.systems');
await main.storage.addWalletStorageProvider(client);
await main.storage.updateBackups();
}
});
});
//# sourceMappingURL=storageClient.man.test.js.map