test: add Phase 4 database integration tests (partial)

- Add comprehensive test utilities for database testing
- Implement connection management tests for in-memory and file databases
- Add transaction tests including nested transactions and savepoints
- Test database lifecycle, error handling, and performance
- Include tests for WAL mode, connection pooling, and constraints

Part of Phase 4: Integration Testing
This commit is contained in:
czlonkowski
2025-07-29 09:36:14 +02:00
parent e66a17b5c2
commit 1d464e29e5
24 changed files with 5391 additions and 55 deletions

View File

@@ -0,0 +1,49 @@
/**
* Mock credential data for MSW handlers
*/
export interface MockCredential {
id: string;
name: string;
type: string;
data?: Record<string, any>; // Usually encrypted in real n8n
createdAt: string;
updatedAt: string;
}
export const mockCredentials: MockCredential[] = [
{
id: 'cred_1',
name: 'Slack Account',
type: 'slackApi',
createdAt: '2024-01-01T00:00:00.000Z',
updatedAt: '2024-01-01T00:00:00.000Z'
},
{
id: 'cred_2',
name: 'HTTP Header Auth',
type: 'httpHeaderAuth',
createdAt: '2024-01-01T00:00:00.000Z',
updatedAt: '2024-01-01T00:00:00.000Z'
},
{
id: 'cred_3',
name: 'OpenAI API',
type: 'openAiApi',
createdAt: '2024-01-01T00:00:00.000Z',
updatedAt: '2024-01-01T00:00:00.000Z'
}
];
/**
* Factory for creating mock credentials
*/
export const credentialFactory = {
create: (type: string, name?: string): MockCredential => ({
id: `cred_${Date.now()}`,
name: name || `${type} Credential`,
type,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
})
};