auto format

This commit is contained in:
Florian Dold 2021-01-13 00:51:30 +01:00
parent 050999a910
commit 7de5ceaa74
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
15 changed files with 49 additions and 44 deletions

View File

@ -1457,7 +1457,9 @@ export async function runTestWithState(
const handleSignal = (s: string) => {
gc.shutdownSync();
console.warn("**** received fatal proces event, shutting down test harness");
console.warn(
"**** received fatal proces event, shutting down test harness",
);
status = "fail";
p.reject(Error("caught signal"));
};

View File

@ -17,10 +17,7 @@
/**
* Imports.
*/
import {
GlobalTestState,
MerchantPrivateApi,
} from "./harness";
import { GlobalTestState, MerchantPrivateApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
import { URL } from "url";

View File

@ -169,4 +169,4 @@ export async function runPaymentTransientTest(t: GlobalTestState) {
`expected status 202 (after paying), but got ${publicOrderStatusResp.status}`,
);
}
}
}

View File

@ -28,7 +28,7 @@ import { Duration, TransactionType } from "taler-wallet-core";
/**
* Basic time travel test.
*/
export async function runTimetravelWithdrawTest(t: GlobalTestState){
export async function runTimetravelWithdrawTest(t: GlobalTestState) {
// Set up test environment
const {
@ -87,4 +87,4 @@ export async function runTimetravelWithdrawTest(t: GlobalTestState){
// This doesn't work yet, see https://bugs.taler.net/n/6585
// await wallet.runUntilDone({ maxRetries: 5 });
}
}

View File

@ -17,11 +17,7 @@
/**
* Imports.
*/
import {
GlobalTestState,
MerchantPrivateApi,
BankApi,
} from "./harness";
import { GlobalTestState, MerchantPrivateApi, BankApi } from "./harness";
import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
/**

View File

@ -1274,7 +1274,9 @@ export async function importBackup(
break;
default:
logger.warn(
`got backup purchase abort_status ${j2s(backupPurchase.abort_status)}`,
`got backup purchase abort_status ${j2s(
backupPurchase.abort_status,
)}`,
);
throw Error("not reachable");
}
@ -1338,8 +1340,7 @@ export async function importBackup(
timestampAccept: backupPurchase.timestamp_accept,
timestampFirstSuccessfulPay:
backupPurchase.timestamp_first_successful_pay,
timestampLastRefundStatus:
undefined,
timestampLastRefundStatus: undefined,
merchantPaySig: backupPurchase.merchant_pay_sig,
lastSessionId: undefined,
abortStatus,
@ -1567,14 +1568,20 @@ export async function runBackupCycle(ws: InternalWalletState): Promise<void> {
continue;
}
const p = proposalId;
await ws.db.runWithWriteTransaction([Stores.backupProviders], async (tx) => {
const provRec = await tx.get(Stores.backupProviders, provider.baseUrl);
checkDbInvariant(!!provRec);
const ids = new Set(provRec.paymentProposalIds)
ids.add(p);
provRec.paymentProposalIds = Array.from(ids);
await tx.put(Stores.backupProviders, provRec);
});
await ws.db.runWithWriteTransaction(
[Stores.backupProviders],
async (tx) => {
const provRec = await tx.get(
Stores.backupProviders,
provider.baseUrl,
);
checkDbInvariant(!!provRec);
const ids = new Set(provRec.paymentProposalIds);
ids.add(p);
provRec.paymentProposalIds = Array.from(ids);
await tx.put(Stores.backupProviders, provRec);
},
);
const confirmRes = await confirmPay(ws, proposalId);
switch (confirmRes.type) {
case ConfirmPayResultType.Pending:

View File

@ -150,7 +150,10 @@ async function refreshCreateSession(
oldDenom.feeRefresh,
).amount;
const newCoinDenoms = selectWithdrawalDenominations(availableAmount, availableDenoms);
const newCoinDenoms = selectWithdrawalDenominations(
availableAmount,
availableDenoms,
);
if (newCoinDenoms.selectedDenoms.length === 0) {
logger.trace(

View File

@ -503,7 +503,9 @@ export async function applyRefund(
let amountRefundGranted = Amounts.getZero(
purchase.download.contractData.amount.currency,
);
let amountRefundGone = Amounts.getZero(purchase.download.contractData.amount.currency);
let amountRefundGone = Amounts.getZero(
purchase.download.contractData.amount.currency,
);
let pendingAtExchange = false;
@ -545,7 +547,8 @@ export async function applyRefund(
summary: purchase.download.contractData.summary,
fulfillmentMessage: purchase.download.contractData.fulfillmentMessage,
summary_i18n: purchase.download.contractData.summaryI18n,
fulfillmentMessage_i18n: purchase.download.contractData.fulfillmentMessageI18n,
fulfillmentMessage_i18n:
purchase.download.contractData.fulfillmentMessageI18n,
},
};
}
@ -669,9 +672,12 @@ async function processPurchaseQueryRefundImpl(
purchase.payCoinSelection.coinContributions[i],
),
rtransaction_id: 0,
execution_time: timestampAddDuration(purchase.download.contractData.timestamp, {
d_ms: 1000,
}),
execution_time: timestampAddDuration(
purchase.download.contractData.timestamp,
{
d_ms: 1000,
},
),
});
}
await acceptRefunds(ws, proposalId, refunds, RefundReason.AbortRefund);

View File

@ -57,7 +57,7 @@ export class InternalWalletState {
constructor(
// FIXME: Make this a getter and make
// the actual value nullable.
// the actual value nullable.
// Check if we are in a DB migration / garbage collection
// and throw an error in that case.
public db: Database<typeof Stores>,

View File

@ -227,7 +227,7 @@ async function processTipImpl(
planchetIndex: planchets.length,
secretSeed: tipRecord.secretSeed,
};
logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`)
logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`);
const p = await ws.cryptoApi.createTipPlanchet(deriveReq);
logger.trace(`derive result: ${j2s(p)}`);
denomForPlanchet[planchets.length] = denom;

View File

@ -269,9 +269,7 @@ export async function getTransactions(
);
let r0: WalletRefundItem | undefined;
let amountRaw = Amounts.getZero(contractData.amount.currency);
let amountEffective = Amounts.getZero(
contractData.amount.currency,
);
let amountEffective = Amounts.getZero(contractData.amount.currency);
for (const rk of Object.keys(pr.refunds)) {
const refund = pr.refunds[rk];
const myGroupKey = `${refund.executionTime.t_ms}`;

View File

@ -86,7 +86,6 @@ export function isWithdrawableDenom(d: DenominationRecord): boolean {
return started && stillOkay && !d.isRevoked;
}
/**
* Get a list of denominations (with repetitions possible)
* whose total value is as close as possible to the available
@ -562,7 +561,6 @@ export async function updateWithdrawalDenoms(
}
}
async function incrementWithdrawalRetry(
ws: InternalWalletState,
withdrawalGroupId: string,

View File

@ -1587,11 +1587,10 @@ class TipsStore extends Store<"tips", TipRecord> {
"tipsByMerchantTipIdAndOriginIndex",
[string, string],
TipRecord
>(
this,
"tipsByMerchantTipIdAndOriginIndex",
["merchantTipId", "merchantBaseUrl"],
);
>(this, "tipsByMerchantTipIdAndOriginIndex", [
"merchantTipId",
"merchantBaseUrl",
]);
}
class WithdrawalGroupsStore extends Store<

View File

@ -124,7 +124,6 @@ export interface RefreshRefusedNotification {
type: NotificationType.RefreshUnwarranted;
}
export interface ReserveConfirmedNotification {
type: NotificationType.ReserveConfirmed;
}

View File

@ -979,7 +979,7 @@ export class Wallet {
async getBackupStatus(): Promise<BackupInfo> {
return getBackupInfo(this.ws);
}
/**
* Implementation of the "wallet-core" API.
*/