Add test case for slug parameter.

This commit is contained in:
Jeff Stieler 2021-09-23 15:11:12 -04:00
parent 99b8e15626
commit 6ecf9a1aaf
1 changed files with 16 additions and 0 deletions

View File

@ -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 );
} );
} ); } );
} ); } );