Skip to content

Instantly share code, notes, and snippets.

@intojs
Created December 5, 2017 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save intojs/bae2f904275c0c3838bfc171919bc80a to your computer and use it in GitHub Desktop.
Save intojs/bae2f904275c0c3838bfc171919bc80a to your computer and use it in GitHub Desktop.
Mocking in TypeScript
import { Product } from './Product';
import { Price } from './Price';
export const filterProductsByName =
(name: string) =>
(products: Product[]) =>
products.filter((product: Product) => product.name.includes(name));
export const addPriceToProduct =
(price: Price) =>
(product: Product) => ({
...product,
price: {...price}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment