Compare commits

...

1 Commits

Author SHA1 Message Date
Jonathan Flatt
71ab44a0e9 fix: Fix Claude integration tests by ensuring provider registration
The Claude webhook integration tests were failing because the provider
wasn't being registered before the routes were imported. This was due
to the conditional check that skips provider initialization in test mode.

Changes:
- Move environment variable setup before any imports
- Import Claude provider before importing webhook routes
- Remove duplicate provider registration from beforeAll hook

This ensures the Claude provider is properly registered with the webhook
registry before the tests run.
2025-06-03 19:15:08 +00:00
2 changed files with 14 additions and 18 deletions

View File

@@ -36,21 +36,19 @@ jest.mock('../../../src/providers/claude/services/SessionManager', () => {
};
});
// Now we can import the routes
import webhookRoutes from '../../../src/routes/webhooks';
// Mock environment variables
// Mock environment variables before importing anything
process.env.CLAUDE_WEBHOOK_SECRET = 'test-secret';
process.env.SKIP_WEBHOOK_VERIFICATION = '1';
// Import and register the Claude provider before importing routes
import '../../../src/providers/claude';
// Now we can import the routes
import webhookRoutes from '../../../src/routes/webhooks';
describe('Claude Session Integration Tests', () => {
let app: express.Application;
beforeAll(() => {
// Import provider to register handlers
require('../../../src/providers/claude');
});
beforeEach(() => {
app = express();
app.use(express.json());

View File

@@ -36,21 +36,19 @@ jest.mock('../../../src/providers/claude/services/SessionManager', () => {
};
});
// Now we can import the routes
import webhookRoutes from '../../../src/routes/webhooks';
// Set environment variables for testing
// Set environment variables before importing anything
process.env.CLAUDE_WEBHOOK_SECRET = 'test-claude-secret';
process.env.SKIP_WEBHOOK_VERIFICATION = '1';
// Import and register the Claude provider before importing routes
import '../../../src/providers/claude';
// Now we can import the routes
import webhookRoutes from '../../../src/routes/webhooks';
describe('Claude Webhook Integration', () => {
let app: express.Application;
beforeAll(() => {
// Import provider to register handlers
require('../../../src/providers/claude');
});
beforeEach(() => {
app = express();
app.use(express.json());