Tuesday, 6 June 2017

Module using another function of the same module

I have something like this:

  • MyModule
    • index.js
    • myFunction1.js
    • myFunction2.js

In index.js file i'm exporting all modules function (myFunction1 and myFunction2). But, in myFunction2 I use myFunction1.

If I import the index (all the module) and call it like MyModule.myFunction1 inside myFunction2, I get an error (function does not exists).

If I import myFunction1.js and call it like myFunction1(), I can't make an Stub of it when I'm going to test it.

Any aproach to do something like this?



via Santiago Mendoza Ramirez

No comments:

Post a Comment