64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { CrossChainOrchestrator } from "../../src/xchain/orchestrator.js";
|
|
import { BridgeConfig } from "../../src/xchain/orchestrator.js";
|
|
|
|
describe("Cross-Chain E2E", () => {
|
|
// These tests require actual bridge setup
|
|
const TEST_RPC = process.env.RPC_MAINNET || "";
|
|
|
|
it.skipIf(!TEST_RPC)("should send CCIP message", async () => {
|
|
const orchestrator = new CrossChainOrchestrator("mainnet", "arbitrum");
|
|
|
|
const bridge: BridgeConfig = {
|
|
type: "ccip",
|
|
sourceChain: "mainnet",
|
|
destinationChain: "arbitrum",
|
|
};
|
|
|
|
// Mock execution - would need actual bridge setup
|
|
const result = await orchestrator.executeCrossChain(
|
|
bridge,
|
|
{ steps: [] } as any,
|
|
"0x123"
|
|
);
|
|
|
|
expect(result).toBeDefined();
|
|
});
|
|
|
|
it.skipIf(!TEST_RPC)("should check message status", async () => {
|
|
const orchestrator = new CrossChainOrchestrator("mainnet", "arbitrum");
|
|
|
|
const bridge: BridgeConfig = {
|
|
type: "ccip",
|
|
sourceChain: "mainnet",
|
|
destinationChain: "arbitrum",
|
|
};
|
|
|
|
const status = await orchestrator.checkMessageStatus(
|
|
bridge,
|
|
"0x1234567890123456789012345678901234567890123456789012345678901234"
|
|
);
|
|
|
|
expect(["pending", "delivered", "failed"]).toContain(status);
|
|
});
|
|
|
|
it.skipIf(!TEST_RPC)("should send LayerZero message", async () => {
|
|
const orchestrator = new CrossChainOrchestrator("mainnet", "arbitrum");
|
|
|
|
const bridge: BridgeConfig = {
|
|
type: "layerzero",
|
|
sourceChain: "mainnet",
|
|
destinationChain: "arbitrum",
|
|
};
|
|
|
|
const result = await orchestrator.executeCrossChain(
|
|
bridge,
|
|
{ steps: [] } as any,
|
|
"0x123"
|
|
);
|
|
|
|
expect(result).toBeDefined();
|
|
});
|
|
});
|
|
|