nac-presale/server/operator.test.ts

18 lines
627 B
TypeScript

import { describe, expect, it } from "vitest";
import { ethers } from "ethers";
describe("OPERATOR_PRIVATE_KEY validation", () => {
it("should be a valid 32-byte hex private key", () => {
const key = process.env.OPERATOR_PRIVATE_KEY;
expect(key).toBeDefined();
expect(key).toMatch(/^[0-9a-fA-F]{64}$/);
});
it("should derive a valid EVM address from the private key", () => {
const key = process.env.OPERATOR_PRIVATE_KEY!;
const wallet = new ethers.Wallet(key);
expect(wallet.address).toMatch(/^0x[0-9a-fA-F]{40}$/);
console.log("[Test] Operator wallet address:", wallet.address);
});
});