Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 1.06 KB

ideas.md

File metadata and controls

42 lines (28 loc) · 1.06 KB

Alternative syntaxes

testMatrix(fn, valuesForParam1, valuesForParam1, ...)

Upsides

  • It allows us to respect how arguments are passed to fn instead of arbitrarily opting for an object.

Downsides

  • If params are not passed as an object, they will be anonymous in the table snapshot

Example

const mult = (a: number, b: number) => a * b
testMatrix(mult, [1, 2], [3, 4])

const add = ({a, b}) => a + b;
testMatrix(mult, {a: [1, 2], b: [3, 4]})

testMatrix(fn).with(...)

It allows us to respect how arguments are passed to fn instead of arbitrarily opting for an object.

Upsides

  • It allows us to respect how arguments are passed to fn instead of arbitrarily opting for an object.
  • The API is a bit easier to read

Downsides

  • If params are not passed as an object, they will be anonymous in the table snapshot
  • Using OOP can result in a more complex API

Example

const mult = (a: number, b: number) => a * b
testMatrix(mult).with([1, 2], [3, 4])

const add = ({a, b}) => a + b
testMatrix(mult).with({a: [1, 2], b: [3, 4]})