//@ts-nocheck import { testFetch } from "../../utils"; import paymentMethodFunctions from "./index"; import Chance from "chance"; import { MISSING_ACCOUNT_ID_ERROR_MESSAGE, MISSING_PAYMENT_METHOD_ID_ERROR_MESSAGE } from "../../constants"; const paymentMethods = paymentMethodFunctions(testFetch); const chance = new Chance(); describe("bank accounts", () => { let accountID, paymentMethodID; beforeEach(() => { accountID = chance.guid(); paymentMethodID = chance.guid(); }); describe("list payment methods", () => { it("should error if no account id", async () => { const resp = await paymentMethods.list({ paymentMethodID }).catch((err) => err); expect(resp.error).toEqual(MISSING_ACCOUNT_ID_ERROR_MESSAGE); }); it("should succeed", async () => { const resp = await paymentMethods.list({ accountID }); expect(resp.url).toEqual(`/accounts/${accountID}/payment-methods`); }); }); describe("get payment method", () => { it("should error if no account id", async () => { const resp = await paymentMethods.get({ paymentMethodID }).catch((err) => err); expect(resp.error).toEqual(MISSING_ACCOUNT_ID_ERROR_MESSAGE); }); it("should error if no payment method id", async () => { const resp = await paymentMethods.get({ accountID }).catch((err) => err); expect(resp.error).toEqual(MISSING_PAYMENT_METHOD_ID_ERROR_MESSAGE); }); it("should succeed", async () => { const resp = await paymentMethods.get({ accountID, paymentMethodID }); expect(resp.url).toEqual(`/accounts/${accountID}/payment-methods/${paymentMethodID}`); }); }); });