Reputation: 4266
I have recently started working with Meteor, and trying to start off as I mean to go on by testing well. To this end, I am using the Velocity test runner and using Jasmine for the actual tests.
Take the very simple case where I have a file in the server directory called hello.js
, which contains our old favourite
var helloWorld = function () {
return "Hello World";
};
Then in my test directory, well 'tests/jasmine/server/unit' I have a test file sampleTest.js
containing the basic test suite
describe("Hello World", function() {
it("should return hello world", function() {
expect(helloWorld()).toBe("Hello World");
});
});
Velocity reports all tests passing, everyone is happy. If I change the original helloWorld
function to return something different, the test fails as expected.
If, however, a second function, of the same name with a different output existed somewhere in the project, e.g.
var helloWorld = function () {
return "Goodbye World";
};
Then this would break the test, but the other version of it passes the test.
Extrapolating from this simplified example, how then do I ensure each function is uniquely named to avoid this problem?
Is my question more a result of my incomplete grasp of Meteor fundamentals (or JS/testing fundamentals in general)?
Upvotes: 0
Views: 376