Deep-audit + build-out across all products to fully-usable state; all typecheck clean. - gitgram-web (99): wire Store feature to real endpoints, close 9 gaps - gitgram-backend (100): close 8 flow gaps, document infra-provisioning items - gitgram-mobile (90): fix API base-URL/path mismatch (404s) + copy proximity components into components/proximity wired to real screens; 15 gaps, +react-native-svg - aitm-core (95): wire natural-language CLI flow end-to-end; 11 gaps - aitm-api (97): fix teams metadata runtime bug; copy a2a-js server/client/grpc into src/a2a and wire A2A route; crates.io package search; 8 gaps - aitm-mcp (100): fix A2A client/server card mismatch; 9 gaps - aitm-website (95): build missing docs routes; 9 gaps Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
/**
|
|
* E2E: System wiring — health, feature flags, and webhook route mounting.
|
|
*
|
|
* Confirms cross-cutting wiring works end-to-end:
|
|
* - health endpoints respond
|
|
* - the GitNexus AI-analysis feature is correctly disabled (503) when its
|
|
* dependency is not provisioned (AI_ANALYSIS_ENABLED=false in E2E)
|
|
* - the dedicated Polar webhook route is mounted and rejects unsigned payloads
|
|
* (the duplicate /subscriptions/webhook route has been removed)
|
|
*/
|
|
import request from 'supertest';
|
|
import type { Express } from 'express';
|
|
import { buildApp, registerUser, bearer, resetDatabase } from './helpers';
|
|
|
|
describe('E2E: System wiring', () => {
|
|
let app: Express;
|
|
|
|
beforeAll(async () => {
|
|
app = buildApp();
|
|
await resetDatabase();
|
|
});
|
|
|
|
it('serves the health endpoint', async () => {
|
|
const res = await request(app).get('/health');
|
|
expect(res.status).toBe(200);
|
|
});
|
|
|
|
it('serves the readiness endpoint', async () => {
|
|
const res = await request(app).get('/health/ready');
|
|
expect([200, 503]).toContain(res.status);
|
|
});
|
|
|
|
it('reports AI analysis disabled and returns 503 from /analyze', async () => {
|
|
const user = await registerUser(app);
|
|
|
|
const status = await request(app).get('/api/v1/tools/ai-analysis/status');
|
|
expect(status.status).toBe(200);
|
|
expect(status.body.enabled).toBe(false);
|
|
|
|
const analyze = await request(app)
|
|
.post('/api/v1/tools/ai-analysis/analyze')
|
|
.set(...bearer(user.token))
|
|
.send({ repoUrl: 'https://github.com/owner/repo' });
|
|
expect(analyze.status).toBe(503);
|
|
expect(analyze.body.available).toBe(false);
|
|
});
|
|
|
|
it('mounts the dedicated Polar webhook and rejects an unsigned payload', async () => {
|
|
const res = await request(app)
|
|
.post('/api/v1/webhooks/polar')
|
|
.set('Content-Type', 'application/json')
|
|
.send({ type: 'subscription.created', data: { id: 'sub_1' } });
|
|
|
|
// Missing signature header -> 400; the route exists and is wired.
|
|
expect(res.status).toBe(400);
|
|
expect(res.body.success).toBe(false);
|
|
});
|
|
|
|
it('confirms the duplicate /subscriptions/webhook route was removed', async () => {
|
|
const res = await request(app)
|
|
.post('/api/v1/subscriptions/webhook')
|
|
.set('Content-Type', 'application/json')
|
|
.send({ type: 'subscription.created', data: { id: 'sub_1' } });
|
|
|
|
// The route no longer exists; Express returns 404 (no handler matched).
|
|
expect(res.status).toBe(404);
|
|
});
|
|
});
|