Files
meteora-dlmm-bot/tests/integration/meteora_mock.test.ts
Louis-Sinan c9daaddb77 first commit
2025-12-21 12:22:16 +01:00

26 lines
827 B
TypeScript

import { Connection, PublicKey } from "@solana/web3.js";
import DLMM from "@meteora-ag/dlmm";
// Mocking the whole DLMM module
jest.mock("@meteora-ag/dlmm");
describe("Meteora SDK Mock Test", () => {
it("should mock DLMM.create", async () => {
const mockPool = {
getActiveBin: jest.fn().mockResolvedValue({ binId: 100, price: "1.23" }),
};
(DLMM.create as jest.Mock).mockResolvedValue(mockPool);
const connection = new Connection("https://api.mainnet-beta.solana.com");
const poolAddress = new PublicKey(
"LbVRzDTvBDEcrthxfZ4RL6yiq3uZw8bS6MwtdY6UhFQ"
);
const pool = await DLMM.create(connection, poolAddress);
const activeBin = await pool.getActiveBin();
expect(activeBin.binId).toBe(100);
expect(DLMM.create).toHaveBeenCalledWith(connection, poolAddress);
});
});