TheFlow
3e656373e7
fix: Prevent ClaudeAPI test from making real HTTPS requests in CI
...
The _makeRequest private method test was calling the real method which
fires an actual HTTPS request to api.anthropic.com. The unhandled
rejection from the 401 response crashed the Jest worker process.
Simplified to verify method exists without triggering network calls.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:50:24 +13:00
TheFlow
9895d155e3
fix: Resolve stale CSS caching and CI test failure
...
- Add ?v= cache-bust parameters to CSS references in index.html,
home-ai.html, and timeline.html (were missing, causing stale CSS)
- Fix version.json: disable forceUpdate (was causing 10s auto-reload
loops), fix minVersion paradox (was 0.2.1 > current 0.1.3)
- Fix update-cache-version.js: stop always setting forceUpdate=true,
add 7 missing HTML files to cache-bust list, add bare CSS/JS
reference detection
- Fix ClaudeAPI.test.js: generateBlogTopics now takes context object,
not positional arguments
- Add spacing between honesty note and Koha section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:10:29 +13:00
TheFlow
ac2db33732
fix(submissions): restructure Economist package and fix article display
...
- Create Economist SubmissionTracking package correctly:
* mainArticle = full blog post content
* coverLetter = 216-word SIR— letter
* Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge
Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150
Next: Enhanced modal with tabs, validation, export
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00
TheFlow
ead22be7e2
refactor: remove orphaned tests for deleted website code
...
REMOVED: 15 test files testing non-existent code
Website Feature Tests (5):
- api.admin.test.js - Tests admin auth (auth.controller/routes removed)
- api.auth.test.js - Tests user authentication (auth.controller/routes removed)
- api.documents.test.js - Tests CMS documents (documents.controller/routes removed)
- api.koha.test.js - Tests donation system (koha.service/controller/routes removed)
- value-pluralism-integration.test.js - Website feature test
Removed Service Tests (5):
- BlogCuration.service.test.js - Service removed
- ClaudeAPI.test.js - Service removed
- koha.service.test.js - Service removed
- AdaptiveCommunicationOrchestrator.test.js - Service removed
- ProhibitedTermsScanner.test.js - Internal tool
Removed Util Tests (1):
- markdown.util.test.js - Util removed
Research/PoC Tests (4):
- tests/poc/memory-tool/* - Phase 5 proof-of-concept research
RETAINED: Framework service tests only
- BoundaryEnforcer, ContextPressureMonitor, CrossReferenceValidator
- InstructionPersistenceClassifier, MetacognitiveVerifier
- PluralisticDeliberationOrchestrator, MemoryProxy
- Integration tests for governance, projects, sync
REASON: Tests must test code that exists. Orphaned tests
provide false confidence and maintenance burden.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 21:33:16 +13:00
TheFlow
9b79c8dea3
test: increase coverage for ClaudeAPI and koha services (9% → 86%)
...
Major test coverage improvements for Week 1 Task 3 (PHASE-4-PREPARATION-CHECKLIST).
ClaudeAPI.service.js Coverage:
- Before: 9.41% (CRITICAL - lowest coverage in codebase)
- After: 85.88% ✅ (exceeds 80% target)
- Tests: 34 passing
- File: tests/unit/ClaudeAPI.test.js (NEW)
Test Coverage:
- Constructor and configuration
- sendMessage() with various options
- extractTextContent() edge cases
- extractJSON() with markdown code blocks
- classifyInstruction() AI classification
- generateBlogTopics() content generation
- classifyMediaInquiry() triage system
- draftMediaResponse() AI drafting
- analyzeCaseRelevance() case study scoring
- curateResource() resource evaluation
- Error handling (network, parsing, empty responses)
- Private _makeRequest() method validation
Mocking Strategy:
- Mocked _makeRequest() to avoid real API calls
- Tested all public methods with mock responses
- Validated error paths and edge cases
koha.service.js Coverage:
- Before: 13.76% (improved from 5.79% after integration tests)
- After: 86.23% ✅ (exceeds 80% target)
- Tests: 34 passing
- File: tests/unit/koha.service.test.js (NEW)
Test Coverage:
- createCheckoutSession() validation and Stripe calls
- handleWebhook() event routing (7 event types)
- handleCheckoutComplete() donation creation/update
- handlePaymentSuccess/Failure() status updates
- handleInvoicePaid() recurring payments
- verifyWebhookSignature() security
- getTransparencyMetrics() public data
- sendReceiptEmail() receipt generation
- cancelRecurringDonation() subscription management
- getStatistics() admin reporting
Mocking Strategy:
- Mocked Stripe SDK (customers, checkout, subscriptions, webhooks)
- Mocked Donation model (all database operations)
- Mocked currency utilities (exchange rates)
- Suppressed console output in tests
Impact:
- 2 of 4 critical services now have >80% coverage
- Added 68 comprehensive test cases
- Improved codebase reliability and maintainability
- Reduced risk for Phase 4 deployment
Remaining Coverage Targets (Task 3):
- governance.routes.js: 31.81% → 80%+ (pending)
- markdown.util.js: 17.39% → 80%+ (pending)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 21:17:32 +13:00