"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const src_1 = require("../../../src");
const testUtils_1 = require("../../testUtils");
const XRPMccConnection = {
    url: process.env.XRP_URL || "https://xrplcluster.com",
    username: process.env.XRP_USERNAME || "",
    password: process.env.XRP_PASSWORD || "",
    apiTokenKey: process.env.FLARE_API_PORTAL_KEY || "",
};
describe(`CheckCash type (${(0, testUtils_1.getTestFile)(__filename)})`, function () {
    let MccClient;
    before(async function () {
        src_1.traceManager.displayRuntimeTrace = false;
        src_1.traceManager.displayStateOnException = false;
        MccClient = new src_1.MCC.XRP(XRPMccConnection);
    });
    describe("CheckCash happy path", function () {
        let transaction;
        before(async function () {
            transaction = await MccClient.getTransaction("67B71B13601CDA5402920691841AC27A156463678E106FABD45357175F9FF406");
        });
        it("should correctly parse sourceAddresses", async function () {
            const addresses = [
                "rw57FJjcRdZ6r3qgwxMNGCD8EJtVkjw1Am", // Transaction sender (pays for fee)
            ];
            (0, chai_1.expect)(transaction.sourceAddresses).to.deep.equal(addresses);
        });
        it("should correctly parse receivingAddresses", async function () {
            (0, chai_1.expect)(transaction.receivingAddresses, "No one receives any xrp").to.deep.equal([]);
        });
        it("should correctly parse spentAmounts", async function () {
            const expected = [{ address: "rw57FJjcRdZ6r3qgwxMNGCD8EJtVkjw1Am", amount: (0, src_1.toBN)("12") }];
            (0, chai_1.expect)((0, testUtils_1.AddressAmountEqual)(transaction.spentAmounts, expected), "Only the fee is payed in xrp").to.be.true;
        });
        it("should correctly parse receivedAmounts", async function () {
            const expected = [];
            (0, chai_1.expect)((0, testUtils_1.AddressAmountEqual)(transaction.receivedAmounts, expected), "No one receives any xrp").to.be.true;
        });
        it("should get balanceDecreasingSummary", async function () {
            const summary = await transaction.balanceDecreasingSummary({ sourceAddressIndicator: (0, src_1.standardAddressHash)("rw57FJjcRdZ6r3qgwxMNGCD8EJtVkjw1Am") });
            (0, chai_1.expect)(summary.status).to.eq(src_1.BalanceDecreasingSummaryStatus.Success);
            (0, chai_1.expect)(summary.response.spentAmount.toString()).to.eq("12");
        });
        // // Token transfers
        // it.skip("should correctly parse assetSourceAddresses", async function () {
        //    return;
        // });
        // it.skip("should correctly parse assetReceivingAddresses", async function () {
        //    return;
        // });
        // it.skip("should correctly parse assetSpentAmounts", async function () {
        //    return;
        // });
        // it.skip("should correctly parse assetReceivedAmounts", async function () {
        //    return;
        // });
    });
});
//# sourceMappingURL=checkCash.test.js.map