Add test case for sku parameter.

This commit is contained in:
Jeff Stieler 2021-09-23 15:15:26 -04:00
parent 6ecf9a1aaf
commit e39261eb20
1 changed files with 17 additions and 0 deletions

View File

@ -156,6 +156,23 @@ const { productsApi } = require('../../endpoints/products');
expect( result2.statusCode ).toEqual( 200 ); expect( result2.statusCode ).toEqual( 200 );
expect( result2.body ).toHaveLength( 0 ); expect( result2.body ).toHaveLength( 0 );
} ); } );
it( 'sku', async () => {
// Match by SKU.
const result1 = await productsApi.listAll.products( {
sku: 'woo-sunglasses'
} );
expect( result1.statusCode ).toEqual( 200 );
expect( result1.body ).toHaveLength( 1 );
expect( result1.body[0].sku ).toBe( 'woo-sunglasses' );
// No matches
const result2 = await productsApi.listAll.products( {
sku: 'no-product-with-this-sku'
} );
expect( result2.statusCode ).toEqual( 200 );
expect( result2.body ).toHaveLength( 0 );
} );
} ); } );
} ); } );