// Address.test.ts
import { describe, it, expect } from "vitest";
import * as Address from "./index.js";
describe("Address", () => {
describe("fromHex", () => {
it("converts valid lowercase hex", () => {
const addr = Address.fromHex("0x742d35cc6634c0532925a3b844bc9e7595f251e3");
expect(addr).toBeInstanceOf(Uint8Array);
expect(addr.length).toBe(20);
});
it("throws on invalid hex", () => {
expect(() => Address.fromHex("0xinvalid")).toThrow();
});
});
describe("toChecksummed", () => {
it("applies EIP-55 checksum", () => {
const addr = Address.fromHex("0x742d35cc6634c0532925a3b844bc9e7595f251e3");
expect(Address.toChecksummed(addr)).toBe("0x742d35Cc6634C0532925a3b844Bc9e7595f251e3");
});
});
});