first commit

This commit is contained in:
Louis-Sinan
2025-12-21 12:22:16 +01:00
commit c9daaddb77
34 changed files with 1735 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
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);
});
});