Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericciarla committed Jun 15, 2024
1 parent f0d4146 commit 519ab1a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/__tests__/e2e_withAuth/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/scraper/WebScraper/__tests__/crawler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});


Expand Down

0 comments on commit 519ab1a

Please sign in to comment.