mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
GitHub Actions Integration Tests (#1466)
* ci: Add Github Actions integration testing against standalone rippled
This commit is contained in:
@@ -1,44 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function getUserHomePath() {
|
||||
return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||
function getAddress() {
|
||||
return 'rQDhz2ZNXmhxzCYwxU6qAbdxsHA4HV45Y2';
|
||||
}
|
||||
|
||||
function loadWallet() {
|
||||
const secretPath = path.join(getUserHomePath(), '.ripple_wallet');
|
||||
try {
|
||||
const walletRaw = fs.readFileSync(secretPath, {encoding: 'utf8'}).trim();
|
||||
return JSON.parse(walletRaw);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const WALLET = loadWallet();
|
||||
|
||||
function getTestKey(key) {
|
||||
if (process.env.TEST_ADDRESS && process.env.TEST_SECRET) {
|
||||
if (key === 'address') {
|
||||
return process.env.TEST_ADDRESS;
|
||||
}
|
||||
if (key === 'secret') {
|
||||
return process.env.TEST_SECRET;
|
||||
}
|
||||
}
|
||||
if (WALLET === null) {
|
||||
throw new Error('Could not find .ripple_wallet file in home directory');
|
||||
}
|
||||
if (WALLET.test === undefined) {
|
||||
throw new Error('Wallet does not contain a "test" account');
|
||||
}
|
||||
return WALLET.test[key];
|
||||
function getSecret() {
|
||||
return 'shK6YXzwYfnFVn3YZSaMh5zuAddKx';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAddress: _.partial(getTestKey, 'address'),
|
||||
getSecret: _.partial(getTestKey, 'secret')
|
||||
getAddress,
|
||||
getSecret
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user