Skip to content

Testing JS

Jest

  • --u
  • -i

npm tests

  • need to pass --
    • npm test -- -u -t="ColorPicker"

Expect an error

Wrap it in an anon function

test(‘’, () => {
  expect(() => {
    calculateSquare());
  }).toThrow(You must provide a number);
})

Last update: 2022-09-23