Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Dec 14, 2024
1 parent 58e7db3 commit 3079459
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
"outputs": [],
"source": [
"import { SERPGoogleScholarAPITool } from \"@langchain/community\";\n",
"import { SERPGoogleScholarAPITool } from \"@langchain/community/tools/google_scholar\";\n",
"\n",
"const tool = new SERPGoogleScholarAPITool({\n",
" apiKey: process.env.SERPAPI_API_KEY,\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import { test, expect, describe } from "@jest/globals";
import { SERPGoogleScholarAPITool } from "../google_scholar.js";
import { getEnvironmentVariable } from "@langchain/core/utils/env";

Check failure on line 3 in libs/langchain-community/src/tools/tests/google_scholar.int.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@langchain/core/utils/env` import should occur before import of `../google_scholar.js`

describe("SERPGoogleScholarAPITool", () => {
test("should be setup with correct parameters", async () => {
const instance = new SERPGoogleScholarAPITool({
apiKey: process.env.SERPAPI_API_KEY,
apiKey: getEnvironmentVariable("SERPAPI_API_KEY"),
});
expect(instance.name).toBe("serp_google_scholar");
});

test("SERPGoogleScholarAPITool returns a string for valid query", async () => {
const tool = new SERPGoogleScholarAPITool({
apiKey: process.env.SERPAPI_API_KEY,
apiKey: getEnvironmentVariable("SERPAPI_API_KEY"),
});
const result = await tool.invoke("Artificial Intelligence");
expect(typeof result).toBe("string");
});

test("SERPGoogleScholarAPITool returns non-empty string for valid query", async () => {
const tool = new SERPGoogleScholarAPITool({
apiKey: process.env.SERPAPI_API_KEY,
apiKey: getEnvironmentVariable("SERPAPI_API_KEY"),
});
const result = await tool.invoke("Artificial Intelligence");
expect(result.length).toBeGreaterThan(0);
});

test("SERPGoogleScholarAPITool returns 'No results found' for bad query", async () => {
const tool = new SERPGoogleScholarAPITool({
apiKey: process.env.SERPAPI_API_KEY,
apiKey: getEnvironmentVariable("SERPAPI_API_KEY"),
});
const result = await tool.invoke("dsalkfjsdlfjasdflasdl");
expect(result).toBe(
Expand Down

0 comments on commit 3079459

Please sign in to comment.