fix: resolve all TypeScript and lint errors in integration tests

- Fixed InMemoryTransport destructuring (object → array)
- Updated all callTool calls to new object syntax
- Changed getServerInfo() to getServerVersion()
- Added type assertions for response objects
- Fixed import paths and missing imports
- Corrected template and performance test type issues
- All 56 TypeScript errors resolved

Both 'npm run lint' and 'npm run typecheck' now pass successfully
This commit is contained in:
czlonkowski
2025-07-29 18:09:03 +02:00
parent c5e012f601
commit e405346b3e
12 changed files with 435 additions and 394 deletions

View File

@@ -55,38 +55,39 @@ describe('TemplateRepository Integration Tests', () => {
it('should handle templates with complex node types', () => {
const template = createTemplateWorkflow({
id: 1,
nodes: [
{
id: 'node1',
name: 'Webhook',
type: 'n8n-nodes-base.webhook',
typeVersion: 1,
position: [100, 100],
parameters: {}
},
{
id: 'node2',
name: 'HTTP Request',
type: 'n8n-nodes-base.httpRequest',
typeVersion: 3,
position: [300, 100],
parameters: {
url: 'https://api.example.com',
method: 'POST'
}
}
]
id: 1
});
const nodes = [
{
id: 'node1',
name: 'Webhook',
type: 'n8n-nodes-base.webhook',
typeVersion: 1,
position: [100, 100],
parameters: {}
},
{
id: 'node2',
name: 'HTTP Request',
type: 'n8n-nodes-base.httpRequest',
typeVersion: 3,
position: [300, 100],
parameters: {
url: 'https://api.example.com',
method: 'POST'
}
}
];
const detail = createTemplateDetail({
id: template.id,
workflow: {
id: template.id.toString(),
name: template.name,
nodes: template.workflow.nodes,
connections: template.workflow.connections,
settings: template.workflow.settings
nodes: nodes,
connections: {},
settings: {}
}
});
repository.saveTemplate(template, detail);
@@ -101,13 +102,7 @@ describe('TemplateRepository Integration Tests', () => {
it('should sanitize workflow data before saving', () => {
const template = createTemplateWorkflow({
workflowInfo: {
nodeCount: 5,
webhookCount: 1,
// Add some data that should be sanitized
executionId: 'should-be-removed',
pinData: { node1: { data: 'sensitive' } }
}
id: 5
});
const detail = createTemplateDetail({
@@ -115,9 +110,20 @@ describe('TemplateRepository Integration Tests', () => {
workflow: {
id: template.id.toString(),
name: template.name,
nodes: template.workflow.nodes,
connections: template.workflow.connections,
settings: template.workflow.settings
nodes: [
{
id: 'node1',
name: 'Start',
type: 'n8n-nodes-base.start',
typeVersion: 1,
position: [100, 100],
parameters: {}
}
],
connections: {},
settings: {},
pinData: { node1: { data: 'sensitive' } },
executionId: 'should-be-removed'
}
});
repository.saveTemplate(template, detail);
@@ -502,9 +508,6 @@ function createTemplateDetail(overrides: any = {}): TemplateDetail {
connections: overrides.connections || {},
settings: overrides.settings || {},
pinData: overrides.pinData
},
categories: overrides.categories || [
{ id: 1, name: 'automation' }
]
}
};
}