I'm trying to write first Unit test through Testing CMD App guide. I've created a test file but it can not find declaration for MyApp to go. Here is code snippet of Unit test;
010_globals.t.js
describe('MyApp Globals', function(t) {
t.ok(MyApp.Globals, 'Globals.js is here');
t.describe('getStatusDesc() method', function(t) {
t.it('should be a function', function(t) {
t.expect(typeof MyApp.Globals.getStatusDesc).toEqual('function');
});
t.it('should return a string', function(t) {
t.expect(typeof MyApp.Globals.getStatusDesc()).toEqual('string');
});
});
});
Test threw an exception
ReferenceError: MyApp is not defined
at line 2, character 10, of 01-unit-tests/010_globals.t.js
- 1. Used loaderPath on harness.configure:
loaderPath: {
'MyApp': 'app'
},
- 2. Used preload on harness.configure:
preload : [
'app/Globals.js'
]
- 3. Used ok method in test file as you see above