"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ChainId_1 = require("@wireio/sdk-core/signing/ChainId");
describe("ChainId", () => {
    describe("ChainName enum", () => {
        it("has UNKNOWN value", () => {
            expect(ChainId_1.ChainName.UNKNOWN).toBe(0);
        });
        it("has SYS value", () => {
            expect(ChainId_1.ChainName.SYS).toBe(1);
        });
        it("has TELOS value", () => {
            expect(ChainId_1.ChainName.TELOS).toBe(2);
        });
        it("has WAX value", () => {
            expect(ChainId_1.ChainName.WAX).toBe(10);
        });
        it("has FIO value", () => {
            expect(ChainId_1.ChainName.FIO).toBe(12);
        });
    });
    describe("ChainId.from", () => {
        it("creates from checksum hex string", () => {
            const id = ChainId_1.ChainId.from("aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906");
            expect(id).toBeInstanceOf(ChainId_1.ChainId);
            expect(id.hexString).toBe("aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906");
        });
        it("creates from ChainName alias", () => {
            const id = ChainId_1.ChainId.from(ChainId_1.ChainName.SYS);
            expect(id).toBeInstanceOf(ChainId_1.ChainId);
            expect(id.hexString).toBe("aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906");
        });
        it("returns the same instance if already a ChainId", () => {
            const id = ChainId_1.ChainId.from("aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906");
            const same = ChainId_1.ChainId.from(id);
            expect(same).toBe(id);
        });
        it("throws for unknown chain alias", () => {
            expect(() => ChainId_1.ChainId.from(999)).toThrow("Unknown chain id alias");
        });
    });
    describe("chainName", () => {
        it("returns the correct ChainName for known chains", () => {
            const id = ChainId_1.ChainId.from(ChainId_1.ChainName.SYS);
            expect(id.chainName).toBe(ChainId_1.ChainName.SYS);
        });
        it("returns UNKNOWN for unrecognized chain ids", () => {
            const id = ChainId_1.ChainId.from("0000000000000000000000000000000000000000000000000000000000000001");
            expect(id.chainName).toBe(ChainId_1.ChainName.UNKNOWN);
        });
    });
});
//# sourceMappingURL=ChainId.test.js.map