From 9fa8b118c27c7345e3c6947584692e2a99cc0252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 11 May 2026 18:42:24 +0200 Subject: [PATCH] catalog-backend: fix syncSearchRows test to expect first-wins semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the 'keeps one row when original_value casing differs' test to expect original_value: 'V' (first occurrence) instead of 'v' (last occurrence), matching the first-wins dedup semantics that were aligned with buildEntitySearch in a prior commit. Signed-off-by: Fredrik Adelöw Co-authored-by: Cursor --- .../src/database/operations/stitcher/syncSearchRows.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts b/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts index 9733f4361b..9cc2af8206 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/syncSearchRows.test.ts @@ -193,14 +193,15 @@ describe.each(databases.eachSupportedId())('syncSearchRows, %p', databaseId => { it('keeps one row when original_value casing differs for same key+value', async () => { // Two entries with the same lowercased (key, value) but different // original_value casing are deduplicated — the UNIQUE constraint on - // (entity_id, key, value) allows only one. The last occurrence wins. + // (entity_id, key, value) allows only one. The first occurrence wins, + // matching the first-wins semantics of buildEntitySearch. await syncSearchRows(knex, 'e1', [row('a', 'v', 'V')]); await syncSearchRows(knex, 'e1', [row('a', 'v', 'V'), row('a', 'v', 'v')]); const rows = await getSearchRows(); expect(rows).toHaveLength(1); expect(rows[0]).toEqual( - expect.objectContaining({ key: 'a', value: 'v', original_value: 'v' }), + expect.objectContaining({ key: 'a', value: 'v', original_value: 'V' }), ); });