test: 🚨 query tests

This commit is contained in:
AP 2020-06-14 14:49:54 +02:00
parent a78b6e96d5
commit 3e6bc6428f
4 changed files with 2137 additions and 89 deletions

View File

@ -1,91 +1,93 @@
export const getNetworkInfo = () =>
Promise.resolve({
average_channel_size: 1000,
channel_count: 123,
max_channel_size: 456,
median_channel_size: 789,
min_channel_size: 100,
node_count: 10000,
not_recently_updated_policy_count: 10,
total_capacity: 10000,
});
export const getWalletInfo = () =>
Promise.resolve({
chains: ['abc', 'def'],
color: 'color',
active_channels_count: 1,
alias: 'TestNode',
current_block_hash: 'asd',
current_block_height: 123456,
is_synced_to_chain: true,
is_synced_to_graph: true,
latest_block_at: 'time',
peers_count: 1,
pending_channels_count: 2,
public_key: 'key',
uris: ['uri', 'uri2'],
version: 'version',
});
export const getClosedChannels = () =>
Promise.resolve({
channels: [
{
capacity: 10000,
close_confirm_height: 123,
close_transaction_id: 'fghijk',
final_local_balance: 123,
final_time_locked_balance: 123,
id: 'id',
is_breach_close: false,
is_cooperative_close: true,
is_funding_cancel: false,
is_local_force_close: false,
is_remote_force_close: false,
partner_public_key: 'abcdef',
transaction_id: '123',
transaction_vout: 1,
},
{
capacity: 10000,
close_confirm_height: 123,
close_transaction_id: 'fghijk',
final_local_balance: 123,
final_time_locked_balance: 123,
id: 'id',
is_breach_close: false,
is_cooperative_close: true,
is_funding_cancel: false,
is_local_force_close: false,
is_remote_force_close: false,
partner_public_key: 'abcdef',
transaction_id: '123',
transaction_vout: 1,
},
{
capacity: 10000,
close_confirm_height: 123,
close_transaction_id: 'fghijk',
final_local_balance: 123,
final_time_locked_balance: 123,
id: 'id',
is_breach_close: false,
is_cooperative_close: true,
is_funding_cancel: false,
is_local_force_close: false,
is_remote_force_close: false,
partner_public_key: 'abcdef',
transaction_id: '123',
transaction_vout: 1,
},
],
});
export const getChainBalance = () =>
Promise.resolve({ chain_balance: 1000000 });
export const getPendingChainBalance = () =>
Promise.resolve({ pending_chain_balance: 1000000 });
import * as res from '../lnServiceResponse';
export const authenticatedLndGrpc = jest.fn().mockReturnValue({});
export const getNetworkInfo = jest
.fn()
.mockReturnValue(Promise.resolve(res.getNetworkInfoResponse));
export const getWalletInfo = jest
.fn()
.mockReturnValue(Promise.resolve(res.getWalletInfoResponse));
export const getClosedChannels = jest
.fn()
.mockReturnValue(Promise.resolve(res.getClosedChannelsResponse));
export const getChainBalance = jest
.fn()
.mockReturnValue(Promise.resolve(res.getChainBalanceResponse));
export const getPendingChainBalance = jest
.fn()
.mockReturnValue(Promise.resolve(res.getPendingChainBalanceResponse));
export const pay = jest.fn().mockReturnValue(Promise.resolve(res.payResponse));
export const decodePaymentRequest = jest
.fn()
.mockReturnValue(Promise.resolve(res.decodePaymentRequestResponse));
export const getBackups = jest
.fn()
.mockReturnValue(Promise.resolve(res.getBackupsResponse));
export const getChainTransactions = jest
.fn()
.mockReturnValue(Promise.resolve(res.getChainTransactionsResponse));
export const getChannels = jest
.fn()
.mockReturnValue(Promise.resolve(res.getChannelsResponse));
export const getChannel = jest
.fn()
.mockReturnValue(Promise.resolve(res.getChannelResponse));
export const getForwards = jest
.fn()
.mockReturnValue(Promise.resolve(res.getForwardsResponse));
export const getInvoices = jest
.fn()
.mockReturnValue(Promise.resolve(res.getInvoicesResponse));
export const getChannelBalance = jest
.fn()
.mockReturnValue(Promise.resolve(res.getChannelBalance));
export const getPeers = jest
.fn()
.mockReturnValue(Promise.resolve(res.getPeersResponse));
export const getPendingChannels = jest
.fn()
.mockReturnValue(Promise.resolve(res.getPendingChannelsResponse));
export const getPayments = jest
.fn()
.mockReturnValue(Promise.resolve(res.getPayments));
export const getUtxos = jest
.fn()
.mockReturnValue(Promise.resolve(res.getUtxosResponse));
export const getWalletVersion = jest
.fn()
.mockReturnValue(Promise.resolve(res.getWalletVersionResponse));
export const recoverFundsFromChannels = jest
.fn()
.mockReturnValue(Promise.resolve());
export const signMessage = jest
.fn()
.mockReturnValue(Promise.resolve(res.signMessageResponse));
export const verifyBackups = jest
.fn()
.mockReturnValue(Promise.resolve(res.verifyBackupsResponse));
export const verifyMessage = jest
.fn()
.mockReturnValue(Promise.resolve(res.verifyMessageResponse));

View File

@ -0,0 +1,728 @@
export const payResponse = {
fee: 123,
fee_mtokens: '500000',
hops: [
{
channel: 'xxx',
channel_capacity: 123,
fee_mtokens: '50000',
forward_mtokens: 5000,
timeout: 123,
},
{
channel: 'xxx',
channel_capacity: 123,
fee_mtokens: '50000',
forward_mtokens: 5000,
timeout: 123,
},
],
id: 'id',
is_confirmed: false,
is_outgoing: false,
mtokens: '1000',
secret: 'secret',
safe_fee: 1,
safe_tokens: 1,
tokens: 1,
};
export const decodePaymentRequestResponse = {
chain_address: 'string',
cltv_delta: 1000,
description: 'string',
description_hash: 'string',
destination: 'string',
expires_at: '2011-10-05T14:48:00.000Z',
features: [
{
bit: 1000,
is_known: true,
is_required: true,
type: 'string',
},
],
id: 'string',
mtokens: '10000',
payment: 'string',
routes: [
[
{
base_fee_mtokens: '10000',
channel: 'string',
cltv_delta: 1000,
fee_rate: 1000,
public_key: 'string',
},
],
],
safe_tokens: 1000,
tokens: 1000,
};
export const getBackupsResponse = {
backup: 'string',
channels: {
backup: 'string',
transaction_id: 'string',
transaction_vout: 1,
},
};
export const getNetworkInfoResponse = {
average_channel_size: 1000,
channel_count: 123,
max_channel_size: 456,
median_channel_size: 789,
min_channel_size: 100,
node_count: 10000,
not_recently_updated_policy_count: 10,
total_capacity: 10000,
};
export const getWalletInfoResponse = {
chains: ['abc', 'def'],
color: 'color',
active_channels_count: 1,
alias: 'TestNode',
current_block_hash: 'asd',
current_block_height: 123456,
is_synced_to_chain: true,
is_synced_to_graph: true,
latest_block_at: 'time',
peers_count: 1,
pending_channels_count: 2,
public_key: 'key',
uris: ['uri', 'uri2'],
version: 'version',
};
export const getClosedChannelsResponse = {
channels: [
{
capacity: 10000,
close_confirm_height: 123,
close_transaction_id: 'fghijk',
final_local_balance: 123,
final_time_locked_balance: 123,
id: 'id',
is_breach_close: false,
is_cooperative_close: true,
is_funding_cancel: false,
is_local_force_close: false,
is_remote_force_close: false,
partner_public_key: 'abcdef',
transaction_id: '123',
transaction_vout: 1,
},
{
capacity: 10000,
close_confirm_height: 123,
close_transaction_id: 'fghijk',
final_local_balance: 123,
final_time_locked_balance: 123,
id: 'id',
is_breach_close: false,
is_cooperative_close: true,
is_funding_cancel: false,
is_local_force_close: false,
is_remote_force_close: false,
partner_public_key: 'abcdef',
transaction_id: '123',
transaction_vout: 1,
},
{
capacity: 10000,
close_confirm_height: 123,
close_transaction_id: 'fghijk',
final_local_balance: 123,
final_time_locked_balance: 123,
id: 'id',
is_breach_close: false,
is_cooperative_close: true,
is_funding_cancel: false,
is_local_force_close: false,
is_remote_force_close: false,
partner_public_key: 'abcdef',
transaction_id: '123',
transaction_vout: 1,
},
],
};
export const getChainBalanceResponse = { chain_balance: 1000000 };
export const getPendingChainBalanceResponse = {
pending_chain_balance: 1000000,
};
export const getChainTransactionsResponse = {
transactions: [
{
block_id: 'string',
confirmation_count: 1000,
confirmation_height: 1000,
created_at: '2011-10-05T14:48:00.000Z',
description: 'string',
fee: 1000,
id: 'string',
is_confirmed: true,
is_outgoing: true,
output_addresses: ['string', 'string'],
tokens: 1000,
transaction: 'string',
},
{
block_id: 'string',
confirmation_count: 1000,
confirmation_height: 1000,
created_at: '2011-10-05T14:48:00.000Z',
description: 'string',
fee: 1000,
id: 'string',
is_confirmed: true,
is_outgoing: true,
output_addresses: ['string', 'string'],
tokens: 1000,
transaction: 'string',
},
],
};
export const getChannelsResponse = {
channels: [
{
capacity: 1000,
commit_transaction_fee: 1000,
commit_transaction_weight: 1000,
cooperative_close_address: 'string',
id: 'string',
is_active: true,
is_closing: true,
is_opening: true,
is_partner_initiated: true,
is_private: true,
is_static_remote_key: true,
local_balance: 1000,
local_given: 1000,
local_reserve: 1000,
partner_public_key: 'string',
pending_payments: [
{
id: 'string',
is_outgoing: true,
timeout: 1000,
tokens: 1000,
},
],
received: 1000,
remote_balance: 1000,
remote_given: 1000,
remote_reserve: 1000,
sent: 1000,
time_offline: 1000,
time_online: 1000,
transaction_id: 'string',
transaction_vout: 1000,
unsettled_balance: 1000,
},
{
capacity: 1000,
commit_transaction_fee: 1000,
commit_transaction_weight: 1000,
cooperative_close_address: 'string',
id: 'string',
is_active: true,
is_closing: true,
is_opening: true,
is_partner_initiated: true,
is_private: true,
is_static_remote_key: true,
local_balance: 1000,
local_given: 1000,
local_reserve: 1000,
partner_public_key: 'string',
pending_payments: [
{
id: 'string',
is_outgoing: true,
timeout: 1000,
tokens: 1000,
},
],
received: 1000,
remote_balance: 1000,
remote_given: 1000,
remote_reserve: 1000,
sent: 1000,
time_offline: 1000,
time_online: 1000,
transaction_id: 'string',
transaction_vout: 1000,
unsettled_balance: 1000,
},
{
capacity: 1000,
commit_transaction_fee: 1000,
commit_transaction_weight: 1000,
cooperative_close_address: 'string',
id: 'string',
is_active: true,
is_closing: true,
is_opening: true,
is_partner_initiated: true,
is_private: true,
is_static_remote_key: true,
local_balance: 1000,
local_given: 1000,
local_reserve: 1000,
partner_public_key: 'string',
pending_payments: [
{
id: 'string',
is_outgoing: true,
timeout: 1000,
tokens: 1000,
},
],
received: 1000,
remote_balance: 1000,
remote_given: 1000,
remote_reserve: 1000,
sent: 1000,
time_offline: 1000,
time_online: 1000,
transaction_id: 'string',
transaction_vout: 1000,
unsettled_balance: 1000,
},
],
};
export const getNodeResponse = {
alias: 'string',
capacity: 1000,
channel_count: 1000,
channels: [
{
capacity: 1000,
id: 'string',
policies: [
{
base_fee_mtokens: '10000',
cltv_delta: 1000,
fee_rate: 1000,
is_disabled: true,
max_htlc_mtokens: '10000',
min_htlc_mtokens: '10000',
public_key: 'string',
updated_at: '2011-10-05T14:48:00.000Z',
},
],
transaction_id: 'string',
transaction_vout: 1000,
updated_at: '2011-10-05T14:48:00.000Z',
},
],
color: 'string',
features: [
{
bit: 1000,
is_known: true,
is_required: true,
type: 'string',
},
],
sockets: [
{
socket: 'string',
type: 'string',
},
],
updated_at: '2011-10-05T14:48:00.000Z',
};
export const getChannelResponse = {
capacity: 1000,
id: 'string',
policies: [
{
base_fee_mtokens: '2000',
cltv_delta: 1000,
fee_rate: 1000,
is_disabled: true,
max_htlc_mtokens: '10000',
min_htlc_mtokens: '10000',
public_key: 'string',
updated_at: '2011-10-05T14:48:00.000Z',
},
],
transaction_id: 'string',
transaction_vout: 1000,
updated_at: '2011-10-05T14:48:00.000Z',
};
export const getForwardsResponse = {
forwards: [
{
created_at: '2011-10-05T14:48:00.000Z',
fee: 1000,
fee_mtokens: 'string',
incoming_channel: '1',
mtokens: 'string',
outgoing_channel: '2',
tokens: 1000,
},
{
created_at: '2011-10-05T14:48:00.000Z',
fee: 1000,
fee_mtokens: 'string',
incoming_channel: '12',
mtokens: 'string',
outgoing_channel: '22',
tokens: 1000,
},
{
created_at: '2011-10-05T14:48:00.000Z',
fee: 1000,
fee_mtokens: 'string',
incoming_channel: '1',
mtokens: 'string',
outgoing_channel: '2',
tokens: 1000,
},
{
created_at: '2011-10-05T14:48:00.000Z',
fee: 1000,
fee_mtokens: 'string',
incoming_channel: '1',
mtokens: 'string',
outgoing_channel: '2',
tokens: 1000,
},
],
next: 'string',
};
export const getInvoicesResponse = {
invoices: [
{
chain_address: 'string',
confirmed_at: 'string',
created_at: 'string',
description: 'string',
description_hash: 'string',
expires_at: 'string',
features: [
{
bit: 1000,
is_known: true,
is_required: true,
type: 'string',
},
],
id: 'string',
is_canceled: true,
is_confirmed: true,
is_held: true,
is_private: true,
is_push: true,
payments: [
{
confirmed_at: 'string',
created_at: 'string',
created_height: 1000,
in_channel: 'string',
is_canceled: true,
is_confirmed: true,
is_held: true,
messages: [
{
type: 'string',
value: 'string',
},
],
mtokens: 'string',
pending_index: 1000,
tokens: 1000,
total_mtokens: 'string',
},
],
received: 1000,
received_mtokens: 'string',
request: 'string',
secret: 'string',
tokens: 1000,
},
],
next: 'string',
};
export const getChannelBalance = {
channel_balance: 1000000,
pending_balance: 50000,
};
export const getPeersResponse = {
peers: [
{
bytes_received: 1000,
bytes_sent: 1000,
features: [
{
bit: 1000,
is_known: true,
is_required: true,
type: 'string',
},
],
is_inbound: true,
is_sync_peer: true,
ping_time: 1000,
public_key: 'abc',
socket: 'string',
tokens_received: 1000,
tokens_sent: 1000,
},
{
bytes_received: 1000,
bytes_sent: 1000,
features: [
{
bit: 1000,
is_known: true,
is_required: true,
type: 'string',
},
],
is_inbound: true,
is_sync_peer: true,
ping_time: 1000,
public_key: 'def',
socket: 'string',
tokens_received: 1000,
tokens_sent: 1000,
},
],
};
export const getPendingChannelsResponse = {
pending_channels: [
{
close_transaction_id: 'string',
is_active: true,
is_closing: true,
is_opening: true,
is_partner_initiated: true,
local_balance: 1000,
local_reserve: 1000,
partner_public_key: 'string',
pending_balance: 1000,
pending_payments: [
{
is_incoming: true,
timelock_height: 1000,
tokens: 1000,
transaction_id: 'string',
transaction_vout: 1000,
},
],
received: 1000,
recovered_tokens: 1000,
remote_balance: 1000,
remote_reserve: 1000,
sent: 1000,
timelock_expiration: 1000,
transaction_fee: 1000,
transaction_id: 'string',
transaction_vout: 1000,
transaction_weight: 1000,
},
{
close_transaction_id: 'string',
is_active: true,
is_closing: true,
is_opening: true,
is_partner_initiated: true,
local_balance: 1000,
local_reserve: 1000,
partner_public_key: 'string',
pending_balance: 1000,
pending_payments: [
{
is_incoming: true,
timelock_height: 1000,
tokens: 1000,
transaction_id: 'string',
transaction_vout: 1000,
},
],
received: 1000,
recovered_tokens: 1000,
remote_balance: 1000,
remote_reserve: 1000,
sent: 1000,
timelock_expiration: 1000,
transaction_fee: 1000,
transaction_id: 'string',
transaction_vout: 1000,
transaction_weight: 1000,
},
{
close_transaction_id: 'string',
is_active: true,
is_closing: true,
is_opening: true,
is_partner_initiated: true,
local_balance: 1000,
local_reserve: 1000,
partner_public_key: 'string',
pending_balance: 1000,
pending_payments: [
{
is_incoming: true,
timelock_height: 1000,
tokens: 1000,
transaction_id: 'string',
transaction_vout: 1000,
},
],
received: 1000,
recovered_tokens: 1000,
remote_balance: 1000,
remote_reserve: 1000,
sent: 1000,
timelock_expiration: 1000,
transaction_fee: 1000,
transaction_id: 'string',
transaction_vout: 1000,
transaction_weight: 1000,
},
],
};
export const getPayments = {
payments: [
{
attempts: [
{
failure: {
code: 1000,
details: {
channel: 'string',
height: 1000,
index: 1000,
mtokens: 'string',
policy: {
base_fee_mtokens: 'string',
cltv_delta: 1000,
fee_rate: 1000,
is_disabled: true,
max_htlc_mtokens: 'string',
min_htlc_mtokens: 'string',
updated_at: 'string',
},
timeout_height: 1000,
update: {
chain: 'string',
channel_flags: 1000,
extra_opaque_data: 'string',
message_flags: 1000,
signature: 'string',
},
},
message: 'string',
},
is_confirmed: true,
is_failed: true,
is_pending: true,
route: {
fee: 1000,
fee_mtokens: 'string',
hops: [
{
channel: 'string',
channel_capacity: 1000,
fee: 1000,
fee_mtokens: 'string',
forward: 1000,
forward_mtokens: 'string',
public_key: 'string',
timeout: 1000,
},
],
mtokens: 'string',
payment: 'string',
timeout: 1000,
tokens: 1000,
total_mtokens: 'string',
},
},
],
created_at: 'string',
destination: 'string',
fee: 1000,
fee_mtokens: 'string',
hops: ['string', 'string'],
id: 'string',
index: 1000,
is_confirmed: true,
is_outgoing: true,
mtokens: 'string',
request: 'string',
safe_fee: 1000,
safe_tokens: 1000,
secret: 'string',
tokens: 1000,
},
],
next: 'string',
};
export const getUtxosResponse = {
utxos: [
{
address: 'string',
address_format: 'string',
confirmation_count: 1000,
output_script: 'string',
tokens: 1000,
transaction_id: 'string',
transaction_vout: 1000,
},
{
address: 'string',
address_format: 'string',
confirmation_count: 1000,
output_script: 'string',
tokens: 1000,
transaction_id: 'string',
transaction_vout: 1000,
},
],
};
export const getWalletVersionResponse = {
build_tags: ['string', 'string'],
commit_hash: 'string',
is_autopilotrpc_enabled: true,
is_chainrpc_enabled: true,
is_invoicesrpc_enabled: true,
is_signrpc_enabled: true,
is_walletrpc_enabled: true,
is_watchtowerrpc_enabled: true,
is_wtclientrpc_enabled: true,
version: 'string',
};
export const signMessageResponse = {
signature: 'signature',
};
export const verifyBackupsResponse = {
is_valid: true,
};
export const verifyMessageResponse = {
signed_by: 'abc',
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,133 @@
import { AuthMock } from 'server/tests/testMocks';
import testServer from 'server/tests/testServer';
import { DECODE_REQUEST } from '../decodeRequest';
import { GET_BACKUPS } from '../getBackups';
import { GET_CHAIN_TRANSACTIONS } from '../getChainTransactions';
import { CHANNEL_FEES } from '../getChannelFees';
import { GET_LIQUID_REPORT } from '../getChannelReport';
import { GET_CHANNELS } from '../getChannels';
import { GET_CLOSED_CHANNELS } from '../getClosedChannels';
import { GET_FEE_HEALTH } from '../getFeeHealth';
import { GET_FORWARD_REPORT } from '../getForwardReport';
import { GET_FORWARDS } from '../getForwards';
import { GET_MESSAGES } from '../getMessages';
import { GET_NETWORK_INFO } from '../getNetworkInfo';
import { GET_NODE } from '../getNode';
import {
GET_NODE_INFO,
GET_CAN_CONNECT,
GET_CHANNEL_AMOUNT_INFO,
GET_CONNECT_INFO,
} from '../getNodeInfo';
import { GET_PEERS } from '../getPeers';
import { GET_PENDING_CHANNELS } from '../getPendingChannels';
import { GET_RESUME } from '../getResume';
import { GET_SERVER_ACCOUNTS } from '../getServerAccounts';
import { GET_TIME_HEALTH } from '../getTimeHealth';
import { GET_UTXOS } from '../getUtxos';
import { GET_VOLUME_HEALTH } from '../getVolumeHealth';
import { GET_WALLET_INFO } from '../getWalletInfo';
import { RECOVER_FUNDS } from '../recoverFunds';
import { SIGN_MESSAGE } from '../signMessage';
import { VERIFY_BACKUPS } from '../verifyBackups';
import { VERIFY_MESSAGE } from '../verifyMessage';
jest.mock('ln-service');
type CaseType = [string, { query: any; variables: {} }];
const cases: CaseType[] = [
[
'DECODE_REQUEST',
{ query: DECODE_REQUEST, variables: { ...AuthMock, request: '' } },
],
['GET_BACKUPS', { query: GET_BACKUPS, variables: AuthMock }],
[
'GET_CHAIN_TRANSACTIONS',
{ query: GET_CHAIN_TRANSACTIONS, variables: AuthMock },
],
['GET_CHANNEL_FEES', { query: CHANNEL_FEES, variables: AuthMock }],
['GET_LIQUID_REPORT', { query: GET_LIQUID_REPORT, variables: AuthMock }],
['GET_CHANNELS', { query: GET_CHANNELS, variables: AuthMock }],
['GET_CLOSED_CHANNELS', { query: GET_CLOSED_CHANNELS, variables: AuthMock }],
['GET_FEE_HEALTH', { query: GET_FEE_HEALTH, variables: AuthMock }],
// [
// 'GET_FORWARD_CHANNELS_REPORT',
// { query: GET_FORWARD_CHANNELS_REPORT, variables: AuthMock },
// ],
['GET_FORWARD_REPORT', { query: GET_FORWARD_REPORT, variables: AuthMock }],
['GET_FORWARDS', { query: GET_FORWARDS, variables: AuthMock }],
['GET_MESSAGES', { query: GET_MESSAGES, variables: AuthMock }],
['GET_NETWORK_INFO', { query: GET_NETWORK_INFO, variables: AuthMock }],
[
'GET_NODE',
{ query: GET_NODE, variables: { ...AuthMock, publicKey: 'abc' } },
],
[
'GET_NODE withoutChannels',
{
query: GET_NODE,
variables: { ...AuthMock, publicKey: 'abc', withoutChannels: false },
},
],
['GET_CAN_CONNECT', { query: GET_CAN_CONNECT, variables: AuthMock }],
['GET_NODE_INFO', { query: GET_NODE_INFO, variables: AuthMock }],
[
'GET_CHANNEL_AMOUNT_INFO',
{ query: GET_CHANNEL_AMOUNT_INFO, variables: AuthMock },
],
['GET_CONNECT_INFO', { query: GET_CONNECT_INFO, variables: AuthMock }],
['GET_PEERS', { query: GET_PEERS, variables: AuthMock }],
[
'GET_PENDING_CHANNELS',
{ query: GET_PENDING_CHANNELS, variables: AuthMock },
],
['GET_RESUME', { query: GET_RESUME, variables: AuthMock }],
['GET_SERVER_ACCOUNTS', { query: GET_SERVER_ACCOUNTS, variables: AuthMock }],
['GET_TIME_HEALTH', { query: GET_TIME_HEALTH, variables: AuthMock }],
['GET_UTXOS', { query: GET_UTXOS, variables: AuthMock }],
['GET_VOLUME_HEALTH', { query: GET_VOLUME_HEALTH, variables: AuthMock }],
['GET_WALLET_INFO', { query: GET_WALLET_INFO, variables: AuthMock }],
[
'RECOVER_FUNDS',
{
query: RECOVER_FUNDS,
variables: { ...AuthMock, backup: '{"backup":"backup_string"}' },
},
],
[
'SIGN_MESSAGE',
{ query: SIGN_MESSAGE, variables: { ...AuthMock, message: 'message' } },
],
[
'VERIFY_BACKUPS',
{
query: VERIFY_BACKUPS,
variables: { ...AuthMock, backup: '{"backup":"backup_string"}' },
},
],
[
'VERIFY_MESSAGE',
{
query: VERIFY_MESSAGE,
variables: { ...AuthMock, message: 'message', signature: 'signature' },
},
],
];
describe('Query tests', () => {
test.each(cases)('%p matches snapshot', async (_, test) => {
const { query } = testServer();
const res = await query({
query: test.query,
variables: test.variables,
});
if (res.errors) {
console.log(JSON.stringify(res.errors));
}
expect(res.errors).toBe(undefined);
expect(res).toMatchSnapshot();
});
});