total-typescript/beginners-typescript-tutorial

Episode 12 should not do both tests with the same number

markm-dragoni opened this issue · 1 comments

const coerceAmount = (amount: number | { amount: number }) => {
  return 20;
};

it("Should return the amount when passed an object", () => {
  expect(coerceAmount({ amount: 20 })).toEqual(20);
});

it("Should return the amount when passed a number", () => {
  expect(coerceAmount(20)).toEqual(20);
});

Ex 12 can be passed with just returning 20, perhaps the tests should use two different numbers to make this work around less obvious?

This seems fine to me!