I have a very simple question. How do I unit test a node.js class/function at a different directory location from my root specs folder?
What I mean here is, say I have a specs folder located at root of my project
/specs/test-spec.js
Here I have a unit test written in jasmine to a helloWorld.js class located in
/service/benefits/programs/california/helloWorld.js
Contents of helloWorld.js
var helloWorld = function(){
return 'hello world';
};
Here is my node-jasmine unit test
helloWorld-spec.js :
describe("Hello World", function() {
it("should return string hello world", function() {
expect(helloWorld()).toEqual('hello world');
});
});
The unit test won't pass because it cannot see helloWorld.js, how can I make it see helloWorld.js
Like should I add something like this:
var helloWorld = require(../../../../helloWorld.js);
I don't even understand what those dots represent? How can I make this work? Anybody? Please help.