Skip to main content

Testing Guide

Best practices for testing your Vera API integration before going to production.

Use your API key in development to test against the live API. All enrichment jobs count against your rate limits, so test thoughtfully.

Testing Error Conditions

Verify your integration handles errors correctly:

# Invalid API key → 401
curl -X POST https://api.veraenrich.com/enrich \
-H "Authorization: Bearer invalid_key" \
-H "Content-Type: application/json" \
-d '{"domain": "stripe.com"}'

# Missing required field → 400
curl -X POST https://api.veraenrich.com/enrich \
-H "Authorization: Bearer $VERA_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'

# Invalid domain → 400
curl -X POST https://api.veraenrich.com/enrich \
-H "Authorization: Bearer $VERA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "not-a-valid-domain"}'

# Non-existent job → 404
curl https://api.veraenrich.com/enrich/00000000-0000-0000-0000-000000000000 \
-H "Authorization: Bearer $VERA_API_KEY"

Mocking the API

For unit tests, mock the Vera API instead of making real requests:

const mockCompletedJob = {
status: 'completed',
domain: 'stripe.com',
data: {
name: 'Stripe',
domain: 'stripe.com',
industry: 'Financial Technology',
employeeCount: '8000-10000',
confidence: 92,
sources: ['website', 'linkedin', 'ai']
}
};

jest.mock('./vera-client');

describe('Lead Enrichment', () => {
it('should enrich a lead with company data', async () => {
const veraClient = require('./vera-client');
veraClient.enrich.mockResolvedValue({ jobId: 'test-123' });
veraClient.getJob.mockResolvedValue(mockCompletedJob);

const lead = { email: 'john@stripe.com', name: 'John Doe' };
const enrichedLead = await enrichLead(lead);

expect(enrichedLead.company.name).toBe('Stripe');
expect(enrichedLead.company.industry).toBe('Financial Technology');
});
});

Pre-Production Checklist

Test CaseExpected Result
Valid enrichment requestReturns jobId with 202 status
Poll for completed jobReturns company data with confidence score
Invalid API keyReturns 401 with AUTHENTICATION_FAILED
Missing required fieldReturns 400 with VALIDATION_ERROR
Rate limit exceededReturns 429 with Retry-After header
Invalid job IDReturns 404 with JOB_NOT_FOUND
Bulk with mixed domainsProcesses valid, reports invalid
Network timeoutYour retry logic handles gracefully

Common Issues

IssueCauseSolution
401 errorsInvalid or missing API keyCheck Authorization header format
Empty company dataDomain has limited online presenceCheck confidence score, handle nulls
Slow responsesLarge company or complex enrichmentImplement proper polling with timeout
Duplicate jobsSame domain submitted multiple timesCache job IDs, check before submitting