fix bank API test
This commit is contained in:
parent
7863bcbcaf
commit
92873710f1
@ -564,8 +564,10 @@ export enum CreditDebitIndicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BankAccountBalanceResponse {
|
export interface BankAccountBalanceResponse {
|
||||||
amount: AmountString;
|
balance: {
|
||||||
credit_debit_indicator: CreditDebitIndicator;
|
amount: AmountString;
|
||||||
|
credit_debit_indicator: CreditDebitIndicator;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace BankAccessApi {
|
export namespace BankAccessApi {
|
||||||
@ -573,7 +575,7 @@ export namespace BankAccessApi {
|
|||||||
bank: BankServiceInterface,
|
bank: BankServiceInterface,
|
||||||
bankUser: BankUser,
|
bankUser: BankUser,
|
||||||
): Promise<BankAccountBalanceResponse> {
|
): Promise<BankAccountBalanceResponse> {
|
||||||
const url = new URL(`accounts/${bankUser.username}/balance`, bank.baseUrl);
|
const url = new URL(`accounts/${bankUser.username}`, bank.baseUrl);
|
||||||
const resp = await axios.get(url.href, {
|
const resp = await axios.get(url.href, {
|
||||||
auth: bankUser,
|
auth: bankUser,
|
||||||
});
|
});
|
||||||
|
@ -113,13 +113,13 @@ runTest(async (t: GlobalTestState) => {
|
|||||||
t.assertTrue(e.response?.status === 409);
|
t.assertTrue(e.response?.status === 409);
|
||||||
}
|
}
|
||||||
|
|
||||||
let bal = await BankAccessApi.getAccountBalance(bank, bankUser);
|
let balResp = await BankAccessApi.getAccountBalance(bank, bankUser);
|
||||||
|
|
||||||
console.log(bal);
|
console.log(balResp);
|
||||||
|
|
||||||
// Check that we got the sign-up bonus.
|
// Check that we got the sign-up bonus.
|
||||||
t.assertAmountEquals(bal.amount, "TESTKUDOS:100");
|
t.assertAmountEquals(balResp.balance.amount, "TESTKUDOS:100");
|
||||||
t.assertTrue(bal.credit_debit_indicator === CreditDebitIndicator.Credit);
|
t.assertTrue(balResp.balance.credit_debit_indicator === CreditDebitIndicator.Credit);
|
||||||
|
|
||||||
const res = createEddsaKeyPair();
|
const res = createEddsaKeyPair();
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ runTest(async (t: GlobalTestState) => {
|
|||||||
reservePub: encodeCrock(res.eddsaPub),
|
reservePub: encodeCrock(res.eddsaPub),
|
||||||
});
|
});
|
||||||
|
|
||||||
bal = await BankAccessApi.getAccountBalance(bank, bankUser);
|
balResp = await BankAccessApi.getAccountBalance(bank, bankUser);
|
||||||
t.assertAmountEquals(bal.amount, "TESTKUDOS:15");
|
t.assertAmountEquals(balResp.balance.amount, "TESTKUDOS:15");
|
||||||
t.assertTrue(bal.credit_debit_indicator === CreditDebitIndicator.Debit);
|
t.assertTrue(balResp.balance.credit_debit_indicator === CreditDebitIndicator.Debit);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user