From c3a850867eb47d45dc284b4c3abc4f6d67015762 Mon Sep 17 00:00:00 2001 From: Andrew Plummer Date: Tue, 10 Dec 2024 12:48:59 -0500 Subject: [PATCH] products test fix --- services/api/src/routes/__tests__/products.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/services/api/src/routes/__tests__/products.js b/services/api/src/routes/__tests__/products.js index 937c9347..c13616e9 100644 --- a/services/api/src/routes/__tests__/products.js +++ b/services/api/src/routes/__tests__/products.js @@ -51,12 +51,22 @@ describe('/1/products', () => { shop: new mongoose.Types.ObjectId(), }); - const response = await request('POST', '/1/products/search', {}, { user }); + const response = await request( + 'POST', + '/1/products/search', + { + sort: { + field: 'name', + order: 'asc', + }, + }, + { user } + ); expect(response.status).toBe(200); const body = response.body; - expect(body.data[1].name).toBe(product1.name); - expect(body.data[0].name).toBe(product2.name); + expect(body.data[0].name).toBe(product1.name); + expect(body.data[1].name).toBe(product2.name); expect(body.meta.total).toBe(2); });