bardjs
bardjs copied to clipboard
mockService cannot omit config
If you try to use mockService without the config you will get an error:
TypeError: Cannot read property '_default' of undefined
at node_modules/bardjs/dist/bard.js:560:37
The problem area is here where if the config has a key you use that key, otherwise you use the config._default, but if there is no config there can be no config._default...
var value = configKeys.indexOf(key) > -1 ?
config[key] : config._default;
Yup this is an issue because the doc clearly states that you should be able to omit config:
/**
* Mocks out a service with sinon stubbed functions
* that return the values specified in the config
*
* If the config value is `undefined`,
* stub the service method with a dummy that doesn't return a value
+1