From 4e9b085738c57e6818c7bfe3fab4f244e512f895 Mon Sep 17 00:00:00 2001 From: Omar Tentouch Date: Sun, 24 May 2026 19:00:14 +0200 Subject: [PATCH] test: add coverage for plain where equality --- src/app.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app.test.ts b/src/app.test.ts index bac286d98..978b35ccb 100644 --- a/src/app.test.ts +++ b/src/app.test.ts @@ -136,6 +136,20 @@ await test('createApp', async (t) => { const data = await response.json() assert.deepEqual(data, [{ id: '1', title: 'foo' }]) }) + await t.test('GET /posts?_where=... supports plain equality shorthand', async () => { + db.data = { + posts: [{ id: '1', title: 'foo' }], + comments: [{ id: '1', postId: '1' }], + object: { f1: 'foo' }, + } + + const where = encodeURIComponent(JSON.stringify({ title: 'foo' })) + const response = await fetch(`http://localhost:${port}/posts?_where=${where}`) + + assert.equal(response.status, 200) + const data = await response.json() + assert.deepEqual(data, [{ id: '1', title: 'foo' }]) +}) await t.test('GET /posts?_where=... overrides query params', async () => { const where = encodeURIComponent(JSON.stringify({ title: { eq: 'foo' } }))