55 classifyThrownError ,
66 SourceIngestionError ,
77} from "../../../convex/ingestionErrors" ;
8+ import { buildFetchHeaders } from "../../../convex/ingest" ;
89import {
910 findSameSourceCandidateByTitle ,
1011 getFailureBackoffUntil ,
@@ -21,6 +22,30 @@ import {
2122 shouldPollLifecycleState ,
2223} from "../../../convex/sourceLifecycle" ;
2324
25+ describe ( "buildFetchHeaders" , ( ) => {
26+ it ( "requests xAI release notes as HTML instead of the stripped Markdown view" , ( ) => {
27+ const headers = buildFetchHeaders ( "VersionWatchBot/1.0" , {
28+ url : "https://docs.x.ai/developers/release-notes" ,
29+ parserKey : "xai:docs_page" ,
30+ sourceType : "docs_page" ,
31+ } ) ;
32+
33+ expect ( headers . Accept ) . toContain ( "text/html" ) ;
34+ expect ( headers . Accept ) . not . toContain ( "text/markdown" ) ;
35+ } ) ;
36+
37+ it ( "keeps direct feeds on RSS/XML-first accept headers" , ( ) => {
38+ const headers = buildFetchHeaders ( "VersionWatchBot/1.0" , {
39+ url : "https://resend.com/changelog/index.xml" ,
40+ parserKey : "resend:rss" ,
41+ sourceType : "rss" ,
42+ } ) ;
43+
44+ expect ( headers . Accept ) . toContain ( "application/rss+xml" ) ;
45+ expect ( headers . Accept ) . not . toContain ( "text/html" ) ;
46+ } ) ;
47+ } ) ;
48+
2449describe ( "hasMeaningfulTitle" , ( ) => {
2550 it ( "allows short semver release titles for GitHub release sources" , ( ) => {
2651 expect ( hasMeaningfulTitle ( "v1.14.21" , "https://github.com/anomalyco/opencode/releases" ) ) . toBe ( true ) ;
0 commit comments