openmct/platform/framework/test/FrameworkInitializerSpec.js
Victor Woeltjen bfcfa0127d [Framework] Spec for FrameworkInitializer
Complete specs for initial implementation of framework
layer, WTD-518.
2014-11-06 19:44:34 -08:00

51 lines
1.5 KiB
JavaScript

/*global define,Promise,describe,it,expect,beforeEach,waitsFor,runs*/
/**
* FrameworkInitializerSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../src/FrameworkInitializer"],
function (FrameworkInitializer) {
"use strict";
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"]
);
});
});
});
}
);