const underTest = require('../../handlers/get-pizzas') const pizzas = [{ id: 1, name: 'Capricciosa' }] describe('Get pizzas handler', () => { it('should return the list of all pizzas', () => { expect(underTest(undefined, pizzas)).toEqual(pizzas) }) it('should return the pizza with the given ID', () => { expect(underTest(1, pizzas)).toEqual(pizzas[0]) }) it('should throw an error if non-existing ID is passed', () => { expect(() => underTest(42, pizzas)).toThrow('...') }) })