Skip to content

Commit

Permalink
products test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewplummer committed Dec 10, 2024
1 parent 5444938 commit c3a8508
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions services/api/src/routes/__tests__/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit c3a8508

Please sign in to comment.