Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Update unit tests

Eric Ciarla519ab1aecb66
diff --git a/apps/api/src/__tests__/e2e_withAuth/index.test.ts b/apps/api/src/__tests__/e2e_withAuth/index.test.ts
index 3b27cbf06..9f04093ac 100644
--- a/apps/api/src/__tests__/e2e_withAuth/index.test.ts
+++ b/apps/api/src/__tests__/e2e_withAuth/index.test.ts
@@ -655,7 +655,7 @@ describe("E2E Tests for API Routes", () => {
const testurls = completedResponse.body.data.map(
(item: any) => item.metadata?.sourceURL
);
- console.log(testurls)
+ //console.log(testurls)
expect(completedResponse.statusCode).toBe(200);
expect(completedResponse.body).toHaveProperty("status");
diff --git a/apps/api/src/scraper/WebScraper/__tests__/crawler.test.ts b/apps/api/src/scraper/WebScraper/__tests__/crawler.test.ts
index 6f7b632c0..c7c54aa6f 100644
--- a/apps/api/src/scraper/WebScraper/__tests__/crawler.test.ts
+++ b/apps/api/src/scraper/WebScraper/__tests__/crawler.test.ts
@@ -73,7 +73,7 @@ describe('WebCrawler maxDepth and filterLinks', () => {
const initialUrl = 'http://example.com'; // Set initial URL for this test
const enteredMaxCrawledDepth = 0;
maxCrawledDepth = getAdjustedMaxDepth(initialUrl, enteredMaxCrawledDepth);
- console.log(maxCrawledDepth);
+
crawler = new WebCrawler({
initialUrl: initialUrl,
@@ -101,7 +101,7 @@ describe('WebCrawler maxDepth and filterLinks', () => {
const initialUrl = 'http://example.com/page1'; // Set initial URL for this test
const enteredMaxCrawledDepth = 1;
maxCrawledDepth = getAdjustedMaxDepth(initialUrl, enteredMaxCrawledDepth);
- console.log(maxCrawledDepth);
+
crawler = new WebCrawler({
initialUrl: initialUrl,
@@ -130,7 +130,7 @@ describe('WebCrawler maxDepth and filterLinks', () => {
const initialUrl = 'http://example.com/page1'; // Set initial URL for this test
const enteredMaxCrawledDepth = 2;
maxCrawledDepth = getAdjustedMaxDepth(initialUrl, enteredMaxCrawledDepth);
- console.log(maxCrawledDepth);
+
crawler = new WebCrawler({
initialUrl: initialUrl,
diff --git a/apps/api/src/scraper/WebScraper/utils/__tests__/maxDepthUtils.test.ts b/apps/api/src/scraper/WebScraper/utils/__tests__/maxDepthUtils.test.ts
index e77242c3b..863a68934 100644
--- a/apps/api/src/scraper/WebScraper/utils/__tests__/maxDepthUtils.test.ts
+++ b/apps/api/src/scraper/WebScraper/utils/__tests__/maxDepthUtils.test.ts
@@ -22,15 +22,25 @@ describe('Testing getURLDepth and getAdjustedMaxDepth', () => {
});
- it('Adjusted maxDepth should return 1 for scrapethissite.com', () => {
+ it('Adjusted maxDepth should return 1 for scrapethissite.com and max depth param of 1', () => {
const enteredURL = "https://scrapethissite.com"
expect(getAdjustedMaxDepth(enteredURL, 1)).toBe(1);
});
+ it('Adjusted maxDepth should return 0 for scrapethissite.com and max depth param of 0', () => {
+ const enteredURL = "https://scrapethissite.com"
+ expect(getAdjustedMaxDepth(enteredURL, 0)).toBe(0);
+
+ });
+
+ it('Adjusted maxDepth should return 0 for mendable.ai and max depth param of 0', () => {
+ const enteredURL = "https://mendable.ai"
+ expect(getAdjustedMaxDepth(enteredURL, 0)).toBe(0);
+ });
- it('Adjusted maxDepth should return 5 for scrapethissite.com/pages/articles', () => {
+ it('Adjusted maxDepth should return 4 for scrapethissite.com/pages/articles and max depth param of 2', () => {
const enteredURL = "https://scrapethissite.com/pages/articles"
- expect(getAdjustedMaxDepth(enteredURL, 2)).toBe(5);
+ expect(getAdjustedMaxDepth(enteredURL, 2)).toBe(4);
});