From 45db4c1b7c67f28b89b278af735266c53de9a32b Mon Sep 17 00:00:00 2001 From: KeKs0r Date: Sun, 27 Sep 2026 01:05:51 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Batch=20text-index=20escape=20check?= =?UTF-8?q?s=20in=20one=20query?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vex-Session: session-3d2280c915ff1d225b320b01 --- packages/cli/src/test/text-index.e2e.test.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/test/text-index.e2e.test.ts b/packages/cli/src/test/text-index.e2e.test.ts index f5571f8..840d483 100644 --- a/packages/cli/src/test/text-index.e2e.test.ts +++ b/packages/cli/src/test/text-index.e2e.test.ts @@ -233,17 +233,27 @@ test('normalization preserves every printable ClickHouse string escape', async ( const { normalizeTextIndexSQL } = await import('@chkit/core') const executor = createLiveExecutor(env) try { + const checks: string[] = [] for (let code = 32; code < 127; code++) { const sql = `'\\${String.fromCharCode(code)}'` if (code === 120) { expect(() => normalizeTextIndexSQL(sql)).toThrow('Invalid hexadecimal') continue } - const rows = await executor.query<{ - original: string - normalized: string - }>(`SELECT hex(${sql}) AS original, hex(${normalizeTextIndexSQL(sql)}) AS normalized`) - expect(rows[0]?.normalized, `escape ${JSON.stringify(sql)}`).toBe(rows[0]?.original) + checks.push( + `SELECT ${code} AS code, hex(${sql}) AS original, hex(${normalizeTextIndexSQL(sql)}) AS normalized`, + ) + } + // Keep the live checks in one request so remote round trips don't exhaust the test timeout. + const rows = await executor.query<{ + code: number + original: string + normalized: string + }>(checks.join('\nUNION ALL\n')) + expect(rows).toHaveLength(checks.length) + for (const { code, original, normalized } of rows) { + const sql = `'\\${String.fromCharCode(code)}'` + expect(normalized, `escape ${JSON.stringify(sql)}`).toBe(original) } } finally { await executor.close()