From e5eb30b2a30a2b91020247924b8fe1cfb7b2cfe0 Mon Sep 17 00:00:00 2001 From: Ben Irvin Date: Thu, 28 Sep 2023 10:31:17 +0200 Subject: [PATCH] add test --- .../api/validate-query/validate-query.test.api.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api-tests/core/strapi/api/validate-query/validate-query.test.api.js b/api-tests/core/strapi/api/validate-query/validate-query.test.api.js index e9d6dd66c8..d415b047a0 100644 --- a/api-tests/core/strapi/api/validate-query/validate-query.test.api.js +++ b/api-tests/core/strapi/api/validate-query/validate-query.test.api.js @@ -154,6 +154,17 @@ describe('Core API - Validate', () => { expect(res.status).toEqual(400); }); + + it.each([ + ['at root', { id: {} }], + ['nested known keys', { id: { $and: { $eq: {}, $contains: {} } } }], + ['nested unknown keys', { id: { foo: { foo: {} } } }], + ])('Empty objects are accepted but sanitized out: %s : %s', async (label, filters) => { + const res = await rq.get('/api/documents', { qs: { filters } }); + + expect(res.status).toEqual(200); + checkAPIResultLength(res, documentsLength()); + }); }); describe('Scalar', () => {