Assuming code like this:
```
import { compoteGraph } from './compute-graph';




export function doTheMath() {
  //  Elaborate work to gather parameters for `computeGraph`.

  const param1 = 1;

  const param2 = 'a';


  const param3 = 'A';


  return computeGraph(param1, param2, param3);

}

```


And it's test

```

import { doTheMath } from './do-the-math';




describe(..., () => {

  it(..., () => {

    expect(doTheMath()).toEqual([1, 'a', 'A']);

  });
});

```

If you would like to mock the `computeGraph` to return fixed value, for 
example array of parameters, you to my knowledge don't have other way, than
using Jest, that does it by utilizing webpack (and possibli other) in the 
middle. 

Or am I wrong? Is there a way to mock imported (`computeGraph`) function 
from within the test?









_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to