"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Asset_1 = require("@wireio/sdk-core/chain/Asset");
describe("Asset", () => {
    test("from string parses correctly", () => {
        const asset = Asset_1.Asset.from("1.0000 SYS");
        expect(asset).toBeInstanceOf(Asset_1.Asset);
    });
    test("toString returns correct string", () => {
        expect(Asset_1.Asset.from("1.0000 SYS").toString()).toBe("1.0000 SYS");
    });
    test("symbol.name returns symbol name", () => {
        expect(Asset_1.Asset.from("1.0000 SYS").symbol.name).toBe("SYS");
    });
    test("symbol.precision returns correct precision", () => {
        expect(Asset_1.Asset.from("1.0000 SYS").symbol.precision).toBe(4);
    });
    test("value returns numeric value", () => {
        expect(Asset_1.Asset.from("1.0000 SYS").value).toBe(1);
    });
    test("value returns fractional value", () => {
        expect(Asset_1.Asset.from("0.5000 SYS").value).toBe(0.5);
    });
    test("from numeric value with symbol", () => {
        const asset = Asset_1.Asset.from(10, "4,SYS");
        expect(asset.toString()).toBe("10.0000 SYS");
    });
    test("fromUnits creates correct asset", () => {
        const asset = Asset_1.Asset.fromUnits(10000, "4,SYS");
        expect(asset.value).toBe(1);
    });
    test("equals returns true for matching assets", () => {
        expect(Asset_1.Asset.from("1.0000 SYS").equals("1.0000 SYS")).toBe(true);
    });
    test("equals returns false for different assets", () => {
        expect(Asset_1.Asset.from("1.0000 SYS").equals("2.0000 SYS")).toBe(false);
    });
});
describe("Asset.Symbol", () => {
    test("from string creates symbol", () => {
        const sym = Asset_1.Asset.Symbol.from("4,SYS");
        expect(sym).toBeInstanceOf(Asset_1.Asset.Symbol);
    });
    test("name returns symbol name", () => {
        expect(Asset_1.Asset.Symbol.from("4,SYS").name).toBe("SYS");
    });
    test("precision returns correct precision", () => {
        expect(Asset_1.Asset.Symbol.from("4,SYS").precision).toBe(4);
    });
    test("toString returns precision,name format", () => {
        expect(Asset_1.Asset.Symbol.from("4,SYS").toString()).toBe("4,SYS");
    });
});
describe("Asset.SymbolCode", () => {
    test("from string creates symbol code", () => {
        const code = Asset_1.Asset.SymbolCode.from("SYS");
        expect(code).toBeInstanceOf(Asset_1.Asset.SymbolCode);
    });
    test("toString returns name", () => {
        expect(Asset_1.Asset.SymbolCode.from("SYS").toString()).toBe("SYS");
    });
});
describe("ExtendedAsset", () => {
    test("from object creates extended asset", () => {
        const ea = Asset_1.ExtendedAsset.from({
            quantity: "1.0000 SYS",
            contract: "sysio.token"
        });
        expect(ea).toBeInstanceOf(Asset_1.ExtendedAsset);
        expect(ea.quantity.toString()).toBe("1.0000 SYS");
        expect(ea.contract.toString()).toBe("sysio.token");
    });
    test("equals returns true for matching extended assets", () => {
        const ea1 = Asset_1.ExtendedAsset.from({
            quantity: "1.0000 SYS",
            contract: "sysio.token"
        });
        const ea2 = Asset_1.ExtendedAsset.from({
            quantity: "1.0000 SYS",
            contract: "sysio.token"
        });
        expect(ea1.equals(ea2)).toBe(true);
    });
});
//# sourceMappingURL=Asset.test.js.map