Skip to content

Latest commit

History

History
15 lines (14 loc) 路 589 Bytes

2021-05-27.md

File metadata and controls

15 lines (14 loc) 路 589 Bytes
publish_date
2021-05-27
  • Used jests test.each for the first time. The syntax is kinda confusing but I grokked it in the end.
    test.each([
      [1, 1, 2],
      [1, 2, 3],
      [2, 1, 3],
    ])(".add(%i, %i)", (a, b, expected) => {
      expect(a + b).toBe(expected);
    });
    The array of arrays passed is the variables and expected params for your test. The last item in the array is the expected value . You can have any number of values before which represent the aruguments or conditions of your text.