tennisgent / quickmock

quickmock is an simple service for automatically injecting mocks into your AngularJS unit tests using Jasmine or Mocha
http://tennisgent.github.io/quickmock
34 stars 14 forks source link

Constants and values that are defined as arrays cause null reference errors #17

Open mitchogaard opened 7 years ago

mitchogaard commented 7 years ago

If you've defined a constant as I have below, QuickMock will get tripped up thinking it's an array of dependencies. Constants and values cannot have dependencies passed to them in this manner.

angular.module('myApp').constant('theUnitedStates', [
    { code: 'AK', name: 'Alaska' },
    { code: 'AL', name: 'Alabama' },
    { code: 'AR', name: 'Arkansas' },
    // ...
]);
mitchogaard commented 7 years ago

I've got a fix for this that I'm currently writing tests around. If I submitted a pull request would you be willing to take it and update the npm version of your package?

mitchogaard commented 7 years ago

I've created a pull request here: https://github.com/tennisgent/quickmock/pull/18