Skip to content

Add unit tests and type definitions for Diffbot knowledge connectors#883

Closed
Copilot wants to merge 1 commit intodiffbot-webcrawler-unit-testingfrom
copilot/sub-pr-882
Closed

Add unit tests and type definitions for Diffbot knowledge connectors#883
Copilot wants to merge 1 commit intodiffbot-webcrawler-unit-testingfrom
copilot/sub-pr-882

Conversation

Copy link

Copilot AI commented Feb 24, 2026

Adds unit test coverage and TypeScript type definitions for the Diffbot webcrawler and webpage knowledge connectors, which previously had none.

Type definitions (types.ts)

  • Crawler API types: CrawlJobSettings, DiffbotResult, DiffbotJobStatus, DiffbotCrawlJob, DiffbotCreateCrawlResponse, DiffbotJobStatusResponse
  • Webpage API types: DiffbotArticle, DiffbotV3AnalyzeResponse, DiffbotRequest, DiffbotImage, DiffbotTag, DiffbotBreadcrumb, DiffbotCategory

Unit tests — diffbotCrawlerConnector

  • Source creation with chunks from crawled pages
  • Multi-page crawl producing multiple sources
  • Upsert of existing source with content hash change
  • Stale source deletion when crawl returns different pages
  • Skips chunk ingestion when upsertKnowledgeSource returns null (content unchanged)
  • retainCrawler: true suppresses job deletion
  • Pages missing pageUrl are skipped
  • Query string passthrough

Unit tests — diffbotWebpageConnector

  • Source creation with chunks
  • Multi-object response produces one source per object with indexed externalIdentifier
  • Upsert of existing source
  • Stale source deletion
  • Skips chunks when upsert returns null
  • Throws when Diffbot returns empty objects array

All tests use Node.js built-in node:test + mock.fn/mock.method, consistent with the rest of the repo.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@graymalkin77
Copy link

graymalkin77 commented Feb 24, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI changed the title [WIP] Add unit tests for Diffbot webcrawler Add unit tests and type definitions for Diffbot knowledge connectors Feb 24, 2026
Copilot AI requested a review from JortegaCognigy February 24, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants