From 6ecf9a1aaf197a82e88b4ed6e18d2cb2832ef802 Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Thu, 23 Sep 2021 15:11:12 -0400 Subject: [PATCH] Add test case for slug parameter. --- .../tests/products/products.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/e2e/api-core-tests/tests/products/products.test.js b/tests/e2e/api-core-tests/tests/products/products.test.js index e72121021a1..bebbd41b26a 100644 --- a/tests/e2e/api-core-tests/tests/products/products.test.js +++ b/tests/e2e/api-core-tests/tests/products/products.test.js @@ -140,6 +140,22 @@ const { productsApi } = require('../../endpoints/products'); } ); + it( 'slug', async () => { + // Match by slug. + const result1 = await productsApi.listAll.products( { + slug: 't-shirt-with-logo' + } ); + expect( result1.statusCode ).toEqual( 200 ); + expect( result1.body ).toHaveLength( 1 ); + expect( result1.body[0].slug ).toBe( 't-shirt-with-logo' ); + + // No matches + const result2 = await productsApi.listAll.products( { + slug: 'no-product-with-this-slug' + } ); + expect( result2.statusCode ).toEqual( 200 ); + expect( result2.body ).toHaveLength( 0 ); + } ); } ); } );