iammerrick/Squire.js

storing mocks with directory paths

anacronw opened this issue · 4 comments

when I tried the following, I didn't get mocks back:

    injector
        .store('directory/module')
        .require('someOtherModule', function(someOtherModule, mocks){
            console.log(mocks); // it returns undefined
        });

Something I'm doing wrong? Should mocks have a property named 'directory/module' in this case?

Does someOtherModule depend on directory/module?

Also you need to tell it you want it like any other require.js magic module (think module, and async require).

   injector
        .store('directory/module')
        .require(['someOtherModule', 'mocks'], function(someOtherModule, mocks){
            console.log(mocks); // it returns undefined
        });

Sorry, that was it - I didn't pass in the 'mocks' dependency.

However, I did get back an object with a "mocks" and "store" properties:

{
  mocks:{},
  store:{
    'directory/module' : {}
  }
}

I think the README is a little misleading in that regard with the line:

    // mocks.CrazyCalculatorDependency is the Calculators dependency, you can

since its technically in mocks.store

Thanks!