Skip to content

Instantly share code, notes, and snippets.

@timdeschryver
Last active June 25, 2018 08:58
Show Gist options
  • Select an option

  • Save timdeschryver/c98df63003cc40d2fc732b9b3e7a2005 to your computer and use it in GitHub Desktop.

Select an option

Save timdeschryver/c98df63003cc40d2fc732b9b3e7a2005 to your computer and use it in GitHub Desktop.
const testCases = [
{
name: 'getProducts',
selector: getProducts,
state: createCatalogState(),
},
{
name: 'getProductSkus',
selector: getProductSkus,
state: createCatalogState(),
},
{
name: 'getCatalog',
selector: getCatalog,
state: createCatalogState(),
},
{
name: 'getCartItems',
selector: getCartItems,
state: createCartState(),
},
{
name: 'getAllCartSummary',
selector: getAllCartSummary,
state: createState(),
},
{
name: 'getCartSummary',
selector: getCartSummary,
state: createState(),
},
];
testCases.forEach(({name, state, selector}) => {
test(`${name} with input ${JSON.stringify(state)}`, () => {
expect(selector(state)).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment