(normalized: string, params: unknown[])
| 51 | } |
| 52 | |
| 53 | function getFakeStatementRow(normalized: string, params: unknown[]) { |
| 54 | if (normalized.startsWith('PRAGMA table_info')) return undefined |
| 55 | if (normalized.includes('FROM sqlite_master')) return undefined |
| 56 | if (normalized === 'SELECT 1 FROM artifacts WHERE id = ?') { |
| 57 | return fakeState.artifacts.has(String(params[0])) ? { 1: 1 } : undefined |
| 58 | } |
| 59 | if (normalized.includes('FROM artifacts WHERE id = ? AND conversation_id = ?')) { |
| 60 | const row = fakeState.artifacts.get(String(params[0])) |
| 61 | return row && row.conversationId === params[1] ? mapArtifact(row) : undefined |
| 62 | } |
| 63 | if (normalized.includes('FROM artifacts WHERE id = ?')) { |
| 64 | const row = fakeState.artifacts.get(String(params[0])) |
| 65 | return row ? mapArtifact(row) : undefined |
| 66 | } |
| 67 | return undefined |
| 68 | } |
| 69 | |
| 70 | function insertFakeArtifact(params: unknown[]) { |
| 71 | const [id, conversationId, kind, content] = params.map(String) |
no test coverage detected