Tesco interview question

Using TDD write a reduce method in JS