I’m trying to test a class that uses atom.config.get(‘package.variable’) but it seems as though during testing this method returns undefined, which I guess makes sense. Is there a way to mock this behavior? (without having to refactor my code to pass a spy into the constructor)
- Are you setting a value for it to read? (I’m pretty sure the Atom Jasmine stuff loads a blank config to prevent your personal settings from polluting the results of the test.)
- Are you activating your package first?
Take a look at the specs in my tabs-to-spaces package where I use configuration fairly extensively:
Ah that fixed it! Forgot to set it beforehand, thank you.
I have never seen this construct before. Is it any different than
buffer = directory = editor = filePath = workspaceElement = null which would be a bit less obscure?