test currency code & address validation on create crypto acct (disabled)

This commit is contained in:
woodser 2022-04-11 17:52:21 -04:00
parent 8f295421c3
commit c5e74947d5

View File

@ -676,7 +676,7 @@ test("Can get market prices", async () => {
expect(btc).toBeLessThan(0.4); expect(btc).toBeLessThan(0.4);
// test invalid currency // test invalid currency
await expect(async () => {await alice.getPrice("INVALID_CURRENCY")}) await expect(async () => { await alice.getPrice("INVALID_CURRENCY") })
.rejects .rejects
.toThrow('Currency not found: INVALID_CURRENCY'); .toThrow('Currency not found: INVALID_CURRENCY');
}); });
@ -856,12 +856,22 @@ test("Can create crypto payment accounts", async () => {
if (!fetchedAccount) throw new Error("Payment account not found after being added"); if (!fetchedAccount) throw new Error("Payment account not found after being added");
testCryptoPaymentAccount(paymentAccount); testCryptoPaymentAccount(paymentAccount);
testCryptoPaymentAccountEquals(fetchedAccount, testAccount, name); testCryptoPaymentAccountEquals(fetchedAccount, testAccount, name);
// TODO (woodser): test rejecting account with invalid currency code
// TODO (woodser): test rejecting account with invalid address
// TODO (woodser): test rejecting account with duplicate name
} }
// TODO (woodser): update from latest Bisq CorePaymentAccountService.java for currency and address validation
/* // test invalid currency code
await expect(async () => { await alice.createCryptoPaymentAccount("My account", "ABC", "123"); })
.rejects
.toThrow('Unsupported cryptocurrency code: ABC');
// test invalid address
await expect(async () => { await alice.createCryptoPaymentAccount("My account", "ETH", "123"); })
.rejects
.toThrow('Invalid address');*/
// TODO (woodser): test rejecting account with duplicate name
function testCryptoPaymentAccountEquals(paymentAccount: PaymentAccount, testAccount: any, name: string) { function testCryptoPaymentAccountEquals(paymentAccount: PaymentAccount, testAccount: any, name: string) {
expect(paymentAccount.getAccountName()).toEqual(name); expect(paymentAccount.getAccountName()).toEqual(name);
expect(paymentAccount.getPaymentAccountPayload()!.getCryptoCurrencyAccountPayload()!.getAddress()).toEqual(testAccount.address); expect(paymentAccount.getPaymentAccountPayload()!.getCryptoCurrencyAccountPayload()!.getAddress()).toEqual(testAccount.address);