tractatus/scripts/test-bi-api.js
TheFlow 62671ea9b9 docs(outreach): select Option C phased rollout with social media validation
Updated media rollout strategy for BI tools launch:

Option C Selected - Phased Approach:
- Week 1-2: LOW-RISK SOCIAL MEDIA EXPOSURE
  * Platforms: Reddit, X/Twitter, Hacker News
  * Goal: Test messaging resonance before formal submissions
  * Learn what value propositions stick with technical audiences
  * Build organic community interest

- Week 3-4: VALIDATE BI tools + Refine Messaging
  * Internal pilot with volunteer organization
  * Adjust narrative based on social feedback
  * Submit to technical outlets if validated (MIT Tech, Wired, IEEE)

- Week 5-6: BUSINESS outlets with full ROI story
  * Submit: Economist, FT, WSJ, NYT
  * Lead with validated "Governance ROI can now be quantified"
  * Evidence: Social validation + pilot data + dashboard demo

Rationale:
- Avoid premature formal submissions with unvalidated messaging
- Gather real-world feedback to refine value propositions
- Build proof of concept before major media push
- Strategic positioning: lead with strongest differentiator

Supporting Scripts:
- add-bi-blog-post.js: Creates blog post draft and calendar task
- test-bi-api.js: Verifies BI API endpoints and database connections

Strategic Insight: User feedback emphasized social media testing
to "see if anything sticks and why" before committing to formal
publication strategy.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 10:38:57 +13:00

60 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
/**
* Test Business Intelligence API Endpoints
* Quick verification that cost config endpoints are working
*/
require('dotenv').config();
const mongoose = require('mongoose');
async function testBIEndpoints() {
try {
console.log('🔍 Testing BI API Endpoints...\n');
// Connect to MongoDB
await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/tractatus_dev');
console.log('✓ Connected to MongoDB');
// Import controller (simulated API call)
const auditController = require('../src/controllers/audit.controller');
// Test getCostConfig
console.log('\n📊 Testing getCostConfig endpoint...');
const mockReq = {};
const mockRes = {
json: (data) => {
console.log('✓ getCostConfig response:');
console.log(JSON.stringify(data, null, 2));
return mockRes;
},
status: (code) => {
console.log(`Status: ${code}`);
return mockRes;
}
};
await auditController.getCostConfig(mockReq, mockRes);
// Test audit logs endpoint exists
console.log('\n📋 Checking audit logs collection...');
const AuditLog = require('../src/models/AuditLog.model');
const count = await AuditLog.countDocuments();
console.log(`✓ Audit logs in database: ${count}`);
// Check for BI-enhanced logs (with activityType field)
const biEnhancedCount = await AuditLog.countDocuments({ activityType: { $exists: true } });
console.log(`✓ BI-enhanced logs (with activityType): ${biEnhancedCount}`);
console.log('\n✅ All BI API endpoints accessible!');
await mongoose.connection.close();
console.log('✓ Disconnected from MongoDB\n');
} catch (error) {
console.error('❌ Error:', error.message);
console.error(error.stack);
process.exit(1);
}
}
testBIEndpoints();