Skip to content

Commit

Permalink
fixing cdp-langchain tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stat committed Dec 3, 2024
1 parent 60c297b commit c26e2ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
1 change: 1 addition & 0 deletions cdp-langchain/src/tests/cdp_tool_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("CdpTool", () => {

beforeAll(async () => {
mockWallet = {} as unknown as jest.Mocked<Wallet>;
jest.spyOn(Wallet, "create").mockResolvedValue(mockWallet);
});

describe("initialization", () => {
Expand Down
20 changes: 3 additions & 17 deletions cdp-langchain/src/tests/cdp_toolkit_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ describe("CdpToolkit", () => {
process.env.CDP_API_KEY_PRIVATE_KEY = "test-private-key";

mockWallet = {} as unknown as jest.Mocked<Wallet>;
jest.spyOn(Wallet, "create").mockResolvedValue(mockWallet);
});

describe("initialization", () => {
it("should successfully init with env", async () => {
const options = {
wallet: mockWallet,
};

const options = {};
await expect(CdpAgentkit.configureWithWallet(options)).resolves.toBeDefined();
});

it("should successfully init with options and without env", async () => {
const options = {
cdpApiKeyName: "test-key",
cdpApiKeyPrivateKey: "test-private-key",
wallet: mockWallet,
};

process.env.CDP_API_KEY_NAME = "";
Expand All @@ -42,14 +39,6 @@ describe("CdpToolkit", () => {
await expect(CdpAgentkit.configureWithWallet(options)).resolves.toBeDefined();
});

it("should successfully init with wallet", async () => {
const options = {
wallet: mockWallet,
};

await expect(CdpAgentkit.configureWithWallet(options)).resolves.toBeDefined();
});

it("should successfully init with wallet data", async () => {
const options = {
cdpWalletData: "{}",
Expand All @@ -61,9 +50,7 @@ describe("CdpToolkit", () => {
});

it("should fail init without env", async () => {
const options = {
wallet: mockWallet,
};
const options = {};

process.env.CDP_API_KEY_NAME = "";
process.env.CDP_API_KEY_PRIVATE_KEY = "";
Expand All @@ -76,7 +63,6 @@ describe("CdpToolkit", () => {
const options = {
cdpApiKeyName: "test-key",
cdpApiKeyPrivateKey: "test-private-key",
wallet: mockWallet,
};

const agentkit = await CdpAgentkit.configureWithWallet(options);
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c26e2ce

Please sign in to comment.