1

I user squireJS to mock dependencys while testing my (requirejs) app. This works as long as I have no "internal" dependencys.

Example:

define(["controller/Storage"], function (StorageController) {
  //some code

   require(["controller/Communication"], function (CommunicationController) {

   });

});

I need to have the second require statement due to a cycling dependency. Anyway, I can mock each dependency defined in the define(....) block, but none of these in the require block.

Any ideas?

Christian
  • 6,961
  • 10
  • 54
  • 82
  • See http://stackoverflow.com/questions/26269119/how-to-mock-inline-requirejs-dependencies-with-squire-for-unit-testing for a potential solution. – Paul Spencer Oct 09 '14 at 01:52

1 Answers1

0

The first thought that comes to mind is using the map config to point references of controller/Communication to some form of mock.

You would need to redefine your require.config() for the tests though, which is not uncommon usually.

Simon Smith
  • 8,024
  • 2
  • 30
  • 40