diff --git a/karma.conf.js b/karma.conf.js index 1547f1991f..8ce816223c 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -81,7 +81,9 @@ module.exports = function(config) { // HTML test reporting. htmlReporter: { - outputDir: "target/tests" + outputDir: "target/tests", + preserveDescribeNesting: true, + foldAll: false }, // Continuous Integration mode. diff --git a/src/BundleRegistrySpec.js b/src/BundleRegistrySpec.js new file mode 100644 index 0000000000..d005209a42 --- /dev/null +++ b/src/BundleRegistrySpec.js @@ -0,0 +1,75 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,runs,jasmine*/ + +define(['./BundleRegistry'], function (BundleRegistry) { + 'use strict'; + + describe("BundleRegistry", function () { + var testPath, + bundleRegistry; + + beforeEach(function () { + testPath = 'some/bundle'; + bundleRegistry = new BundleRegistry(); + }); + + it("initially lists no bundles", function () { + expect(bundleRegistry.list()).toEqual([]); + }); + + it("initially contains no bundles", function () { + expect(bundleRegistry.contains(testPath)) + .toBe(false); + }); + + it("initially provides no bundles", function () { + expect(bundleRegistry.get(testPath)) + .toBeUndefined(); + }); + + describe("when a bundle has been registered", function () { + var testBundleDef; + + beforeEach(function () { + testBundleDef = { someKey: "some value" }; + bundleRegistry.register(testPath, testBundleDef); + }); + + it("lists registered bundles", function () { + expect(bundleRegistry.list()).toEqual([testPath]); + }); + + it("contains registered bundles", function () { + expect(bundleRegistry.contains(testPath)) + .toBe(true); + }); + + it("provides registered bundles", function () { + expect(bundleRegistry.get(testPath)) + .toBe(testBundleDef); + }); + }); + + }); + +}); \ No newline at end of file diff --git a/src/legacyRegistrySpec.js b/src/legacyRegistrySpec.js new file mode 100644 index 0000000000..a4b37ea68a --- /dev/null +++ b/src/legacyRegistrySpec.js @@ -0,0 +1,35 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,runs,jasmine*/ + +define([ + './legacyRegistry', + './BundleRegistry' +], function (legacyRegistry, BundleRegistry) { + 'use strict'; + + describe("legacyRegistry", function () { + it("is a BundleRegistry", function () { + expect(legacyRegistry instanceof BundleRegistry).toBe(true); + }); + }); +});