mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-29 05:33:07 +00:00
fix: update community integration test mock for INSERT OR REPLACE
The mock SQL matching used 'INSERT INTO nodes' which doesn't match 'INSERT OR REPLACE INTO nodes'. Also added handler for the new SELECT npm_readme query in saveNode. Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -87,7 +87,7 @@ class InMemoryDatabaseAdapter implements DatabaseAdapter {
|
|||||||
|
|
||||||
class InMemoryPreparedStatement implements PreparedStatement {
|
class InMemoryPreparedStatement implements PreparedStatement {
|
||||||
run = vi.fn((...params: any[]): RunResult => {
|
run = vi.fn((...params: any[]): RunResult => {
|
||||||
if (this.sql.includes('INSERT INTO nodes')) {
|
if (this.sql.includes('INSERT') && this.sql.includes('INTO nodes')) {
|
||||||
const node = this.paramsToNode(params);
|
const node = this.paramsToNode(params);
|
||||||
this.adapter.saveNode(node);
|
this.adapter.saveNode(node);
|
||||||
return { changes: 1, lastInsertRowid: 1 };
|
return { changes: 1, lastInsertRowid: 1 };
|
||||||
@@ -100,6 +100,9 @@ class InMemoryPreparedStatement implements PreparedStatement {
|
|||||||
});
|
});
|
||||||
|
|
||||||
get = vi.fn((...params: any[]) => {
|
get = vi.fn((...params: any[]) => {
|
||||||
|
if (this.sql.includes('SELECT npm_readme')) {
|
||||||
|
return undefined; // No existing docs to preserve
|
||||||
|
}
|
||||||
if (this.sql.includes('SELECT * FROM nodes WHERE node_type = ?')) {
|
if (this.sql.includes('SELECT * FROM nodes WHERE node_type = ?')) {
|
||||||
return this.adapter.getNode(params[0]);
|
return this.adapter.getNode(params[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user