2014-11-07 03:44:34 +00:00
|
|
|
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,runs*/
|
2014-11-06 16:03:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* FrameworkInitializerSpec. Created by vwoeltje on 11/6/14.
|
|
|
|
*/
|
|
|
|
define(
|
2014-11-07 03:44:34 +00:00
|
|
|
["../src/FrameworkInitializer"],
|
|
|
|
function (FrameworkInitializer) {
|
2014-11-06 16:03:35 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-11-07 03:44:34 +00:00
|
|
|
describe("The framework initializer", function () {
|
|
|
|
var initializer;
|
|
|
|
|
|
|
|
function appender(name) {
|
|
|
|
return function (value) {
|
|
|
|
return Promise.resolve(value.concat([name]));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
initializer = new FrameworkInitializer(
|
|
|
|
{ loadBundles: appender("loader") },
|
|
|
|
{ resolveBundles: appender("resolver") },
|
|
|
|
{ registerExtensions: appender("registrar") },
|
|
|
|
{ bootstrap: appender("bootstrapper")}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Really just delegates work, can only verify the
|
|
|
|
// order of calls.
|
|
|
|
it("calls injected stages in order", function () {
|
|
|
|
var result;
|
|
|
|
|
|
|
|
initializer.runApplication([]).then(function (v) { result = v; });
|
|
|
|
|
|
|
|
waitsFor(
|
|
|
|
function () { return result !== undefined; },
|
|
|
|
"promise resolution",
|
|
|
|
250
|
|
|
|
);
|
|
|
|
|
|
|
|
runs(function () {
|
|
|
|
expect(result).toEqual(
|
|
|
|
["loader", "resolver", "registrar", "bootstrapper"]
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2014-11-06 16:03:35 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|