Thanks. I tried your suggestion and it works, although at first glance, it
doesn't seem to be a mock. Is that defining a new module or mocking one
with the same name?
On Sunday, August 16, 2015 at 12:36:57 PM UTC-4, András Csányi wrote:
>
> Hi,
>
> Try this:
>
> angular.module('ui.bootstrap', [])
>
> if you need only a mock.
>
>
> http://www.sitepoint.com/unit-testing-angularjs-services-controllers-providers/
>
> On 16 August 2015 at 15:02, Alex Fu <[email protected] <javascript:>>
> wrote:
>
>> I'm having some trouble understanding how to mock my module dependencies
>> for unit testing.
>>
>> I have a module declared like so...
>>
>> var app = angular.module('myApp', ['ui.bootstrap', 'ngFileUpload']);
>>
>> Now for testing my controllers I have to load up my module and all of
>> it's dependencies, but I would want to mock out my modules dependencies
>> when testing a controller.
>>
>> I've been searching the guides for how to mock a module dependency but
>> came up with nothing. I've blindly tried to use *angular.mock.module...*
>>
>> beforeEach(function() {
>> angular.module.mock('ui.bootstrap');
>> angular.module.mock('ngFileUpload');
>> module('myApp');
>> });
>>
>> but that still gives me the "Module 'ui.bootstrap' is not available!"
>> error.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "AngularJS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> -- Csanyi Andras (Sayusi Ando) -- http://sayusi.hu --
> http://facebook.com/andras.csanyi
> -- ""Trust in God and keep your gunpowder dry!" - Cromwell
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.