Skip to content

Commit

Permalink
Fix test for new module route
Browse files Browse the repository at this point in the history
The js base route is now js/modules/%modulename%/%file%. This
commit reflects these changes in the testcases

refs #4092
refs #3735
  • Loading branch information
Jannis Moßhammer authored and mxhash committed Jun 26, 2013
1 parent fc83dfb commit 33b4a2c
Showing 1 changed file with 4 additions and 58 deletions.
62 changes: 4 additions & 58 deletions test/js/test/icinga/moduleTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
// {{LICENSE_HEADER}}
var should = require("should");
var rjsmock = require("requiremock.js");
var asyncMock = require("asyncmock.js");

requireNew("icinga/module.js");
var BASE = "../../../../public/js/";
require(BASE+"icinga/module.js");

var module = rjsmock.getDefine();
GLOBAL.document = $('body');

/**
* Test module that only uses eventhandlers and
* no custom logic
Expand Down Expand Up @@ -195,9 +195,6 @@ describe('The icinga module bootstrap', function() {
var testClick = false;
rjsmock.registerDependencies({
"icinga/module": module,
"icinga/util/async" : {
registerHeaderListener: function() {}
},
"modules/test/test" : {
eventHandler: {
"a.test" : {
Expand All @@ -217,7 +214,7 @@ describe('The icinga module bootstrap', function() {
]
});
tearDownTestDOM();
requireNew("icinga/icinga.js");
require(BASE+"icinga/icinga.js");
var icinga = rjsmock.getDefine();
$('body').append($("<a class='test'></a>"));
$('a.test').click();
Expand All @@ -226,55 +223,4 @@ describe('The icinga module bootstrap', function() {
should.equal(icinga.getFailedModules()[0].name, "test2");
tearDownTestDOM();
});

it("Should load modules lazily when discovering a X-Icinga-Enable-Module header", function() {
rjsmock.purgeDependencies();

requireNew("icinga/util/async.js");
var async = rjsmock.getDefine();

rjsmock.registerDependencies({
"icinga/module": module,
"icinga/util/async": async,
"modules/test/test" : {
eventHandler: {
"a.test" : {
click : function() {
testClick = true;
}
}
}
},
"icinga/container" : {
registerAsyncMgr: function() {},
initializeContainers: function() {}
},
"modules/list" : [
]
});

tearDownTestDOM();

requireNew("icinga/icinga.js");
var icinga = rjsmock.getDefine();

var testClick = false;
// The module shouldn't be loaded
$('body').append($("<a class='test'></a>"));
$('a.test').click();
should.equal(testClick, false, "Unregistered module was loaded");

asyncMock.setNextAsyncResult(async,"result", false, {
"X-Icinga-Enable-Module" : "test"
});
async.createRequest();
// The module shouldn't be loaded
$('body').append($("<a class='test'></a>"));
$('a.test').click();
should.equal(testClick, true, "Module wasn't automatically loaded on header!");


tearDownTestDOM();

});
});

0 comments on commit 33b4a2c

Please sign in to comment.