mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 12:05:19 +00:00
[Testing] Resolve all promises (#3829)
* all promises in test specs should be returned Co-authored-by: Shefali Joshi <simplyrender@gmail.com> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
9d8a8b36d2
commit
333e8b5583
@ -73,7 +73,7 @@ describe('the plugin', function () {
|
||||
});
|
||||
|
||||
it('provides a folder to hold plans', () => {
|
||||
openmct.objects.get(identifier).then((object) => {
|
||||
return openmct.objects.get(identifier).then((object) => {
|
||||
expect(object).toEqual({
|
||||
identifier,
|
||||
type: 'folder',
|
||||
@ -83,7 +83,7 @@ describe('the plugin', function () {
|
||||
});
|
||||
|
||||
it('provides composition for couch search folders', () => {
|
||||
composition.load().then((objects) => {
|
||||
return composition.load().then((objects) => {
|
||||
expect(objects.length).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
@ -67,10 +67,6 @@ describe("The LAD Table", () => {
|
||||
|
||||
// this setups up the app
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
openmct = createOpenMct();
|
||||
|
||||
parent = document.createElement('div');
|
||||
@ -90,7 +86,7 @@ describe("The LAD Table", () => {
|
||||
});
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless(appHolder);
|
||||
openmct.startHeadless();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -113,7 +109,8 @@ describe("The LAD Table", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
ladTableCompositionCollection = openmct.composition.get(mockObj.ladTable);
|
||||
ladTableCompositionCollection.load();
|
||||
|
||||
return ladTableCompositionCollection.load();
|
||||
});
|
||||
|
||||
it("should accept telemetry producing objects", () => {
|
||||
@ -192,8 +189,6 @@ describe("The LAD Table", () => {
|
||||
|
||||
await Promise.all([telemetryRequestPromise, telemetryObjectPromise, anotherTelemetryObjectPromise]);
|
||||
await Vue.nextTick();
|
||||
|
||||
return;
|
||||
});
|
||||
|
||||
it("should show one row per object in the composition", () => {
|
||||
@ -242,13 +237,6 @@ describe("The LAD Table Set", () => {
|
||||
let ladPlugin;
|
||||
let parent;
|
||||
let child;
|
||||
let telemetryCount = 3;
|
||||
let timeFormat = 'utc';
|
||||
|
||||
let mockTelemetry = getMockTelemetry({
|
||||
count: telemetryCount,
|
||||
format: timeFormat
|
||||
});
|
||||
|
||||
let mockObj = getMockObjects({
|
||||
objectKeyStrings: ['ladTable', 'ladTableSet', 'telemetry']
|
||||
@ -264,31 +252,22 @@ describe("The LAD Table Set", () => {
|
||||
mockObj.ladTableSet.composition.push(mockObj.ladTable.identifier);
|
||||
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
openmct = createOpenMct();
|
||||
|
||||
parent = document.createElement('div');
|
||||
child = document.createElement('div');
|
||||
parent.appendChild(child);
|
||||
|
||||
spyOn(openmct.telemetry, 'request').and.returnValue(Promise.resolve([]));
|
||||
|
||||
ladPlugin = new LadPlugin();
|
||||
openmct.install(ladPlugin);
|
||||
|
||||
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
|
||||
|
||||
openmct.time.bounds({
|
||||
start: bounds.start,
|
||||
end: bounds.end
|
||||
});
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.start(appHolder);
|
||||
openmct.startHeadless();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -301,6 +280,8 @@ describe("The LAD Table Set", () => {
|
||||
});
|
||||
|
||||
it("should provide a lad table set view only for lad table set objects", () => {
|
||||
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
|
||||
|
||||
let applicableViews = openmct.objectViews.get(mockObj.ladTableSet, []);
|
||||
|
||||
let ladTableSetView = applicableViews.find(
|
||||
@ -315,8 +296,11 @@ describe("The LAD Table Set", () => {
|
||||
let ladTableSetCompositionCollection;
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
|
||||
|
||||
ladTableSetCompositionCollection = openmct.composition.get(mockObj.ladTableSet);
|
||||
ladTableSetCompositionCollection.load();
|
||||
|
||||
return ladTableSetCompositionCollection.load();
|
||||
});
|
||||
|
||||
it("should accept lad table objects", () => {
|
||||
@ -354,41 +338,17 @@ describe("The LAD Table Set", () => {
|
||||
otherObj.ladTable.composition.push(mockObj.telemetry.identifier);
|
||||
mockObj.ladTableSet.composition.push(otherObj.ladTable.identifier);
|
||||
|
||||
beforeEach(async () => {
|
||||
let telemetryRequestResolve;
|
||||
let ladObjectResolve;
|
||||
let anotherLadObjectResolve;
|
||||
beforeEach(() => {
|
||||
spyOn(openmct.telemetry, 'request').and.returnValue(Promise.resolve([]));
|
||||
|
||||
let telemetryRequestPromise = new Promise((resolve) => {
|
||||
telemetryRequestResolve = resolve;
|
||||
});
|
||||
|
||||
let ladObjectPromise = new Promise((resolve) => {
|
||||
ladObjectResolve = resolve;
|
||||
});
|
||||
|
||||
let anotherLadObjectPromise = new Promise((resolve) => {
|
||||
anotherLadObjectResolve = resolve;
|
||||
});
|
||||
|
||||
openmct.telemetry.request.and.callFake(() => {
|
||||
telemetryRequestResolve(mockTelemetry);
|
||||
|
||||
return telemetryRequestPromise;
|
||||
});
|
||||
|
||||
openmct.objects.get.and.callFake((obj) => {
|
||||
spyOn(openmct.objects, 'get').and.callFake((obj) => {
|
||||
if (obj.key === 'lad-object') {
|
||||
ladObjectResolve(mockObj.ladObject);
|
||||
|
||||
return ladObjectPromise;
|
||||
return Promise.resolve(mockObj.ladTable);
|
||||
} else if (obj.key === 'another-lad-object') {
|
||||
anotherLadObjectResolve(otherObj.ladObject);
|
||||
|
||||
return anotherLadObjectPromise;
|
||||
return Promise.resolve(otherObj.ladTable);
|
||||
} else if (obj.key === 'telemetry-object') {
|
||||
return Promise.resolve(mockObj.telemetry);
|
||||
}
|
||||
|
||||
return Promise.resolve({});
|
||||
});
|
||||
|
||||
openmct.time.bounds({
|
||||
@ -399,20 +359,19 @@ describe("The LAD Table Set", () => {
|
||||
applicableViews = openmct.objectViews.get(mockObj.ladTableSet, []);
|
||||
ladTableSetViewProvider = applicableViews.find((viewProvider) => viewProvider.key === ladTableSetKey);
|
||||
ladTableSetView = ladTableSetViewProvider.view(mockObj.ladTableSet, [mockObj.ladTableSet]);
|
||||
ladTableSetView.show(child, true);
|
||||
ladTableSetView.show(child);
|
||||
|
||||
await Promise.all([telemetryRequestPromise, ladObjectPromise, anotherLadObjectPromise]);
|
||||
await Vue.nextTick();
|
||||
|
||||
return;
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
it("should show one row per lad table object in the composition", () => {
|
||||
const rowCount = parent.querySelectorAll(LAD_SET_TABLE_HEADERS).length;
|
||||
const ladTableSetCompositionCollection = openmct.composition.get(mockObj.ladTableSet);
|
||||
|
||||
expect(rowCount).toBe(mockObj.ladTableSet.composition.length);
|
||||
pending();
|
||||
return ladTableSetCompositionCollection.load().then(() => {
|
||||
const rowCount = parent.querySelectorAll(LAD_SET_TABLE_HEADERS).length;
|
||||
|
||||
expect(rowCount).toBe(mockObj.ladTableSet.composition.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -22,12 +22,14 @@
|
||||
|
||||
define(
|
||||
[
|
||||
"utils/testing",
|
||||
"./URLIndicator",
|
||||
"./URLIndicatorPlugin",
|
||||
"../../MCT",
|
||||
"zepto"
|
||||
],
|
||||
function (
|
||||
testingUtils,
|
||||
URLIndicator,
|
||||
URLIndicatorPlugin,
|
||||
MCT,
|
||||
@ -44,7 +46,7 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
jasmine.clock().install();
|
||||
openmct = new MCT();
|
||||
openmct = new testingUtils.createOpenMct();
|
||||
spyOn(openmct.indicators, 'add');
|
||||
spyOn($, 'ajax');
|
||||
$.ajax.and.callFake(function (options) {
|
||||
@ -55,6 +57,8 @@ define(
|
||||
afterEach(function () {
|
||||
$.ajax = defaultAjaxFunction;
|
||||
jasmine.clock().uninstall();
|
||||
|
||||
return testingUtils.resetApplicationState(openmct);
|
||||
});
|
||||
|
||||
describe("on initialization", function () {
|
||||
|
@ -28,8 +28,10 @@ import {
|
||||
resetApplicationState,
|
||||
spyOnBuiltins
|
||||
} from 'utils/testing';
|
||||
import Vue from 'vue';
|
||||
|
||||
describe("AutoflowTabularPlugin", () => {
|
||||
// TODO lots of its without expects
|
||||
xdescribe("AutoflowTabularPlugin", () => {
|
||||
let testType;
|
||||
let testObject;
|
||||
let mockmct;
|
||||
@ -51,7 +53,7 @@ describe("AutoflowTabularPlugin", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
resetApplicationState(mockmct);
|
||||
return resetApplicationState(mockmct);
|
||||
});
|
||||
|
||||
it("installs a view provider", () => {
|
||||
@ -101,7 +103,7 @@ describe("AutoflowTabularPlugin", () => {
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
callbacks = {};
|
||||
|
||||
spyOnBuiltins(['requestAnimationFrame']);
|
||||
@ -180,7 +182,7 @@ describe("AutoflowTabularPlugin", () => {
|
||||
view = provider.view(testObject);
|
||||
view.show(testContainer);
|
||||
|
||||
return done();
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -121,10 +121,9 @@ describe("The Duplicate Action plugin", () => {
|
||||
|
||||
describe("when moving an object to a new parent", () => {
|
||||
|
||||
beforeEach(async (done) => {
|
||||
beforeEach(async () => {
|
||||
duplicateTask = new DuplicateTask(openmct);
|
||||
await duplicateTask.duplicate(parentObject, anotherParentObject);
|
||||
done();
|
||||
});
|
||||
|
||||
it("the duplicate child object's name (when not changing) should be the same as the original object", async () => {
|
||||
@ -143,15 +142,15 @@ describe("The Duplicate Action plugin", () => {
|
||||
});
|
||||
|
||||
describe("when a new name is provided for the duplicated object", () => {
|
||||
const NEW_NAME = 'New Name';
|
||||
it("the name is updated", () => {
|
||||
const NEW_NAME = 'New Name';
|
||||
let childName;
|
||||
|
||||
beforeEach(() => {
|
||||
duplicateTask = new DuplicateAction(openmct);
|
||||
duplicateTask.updateNameCheck(parentObject, NEW_NAME);
|
||||
});
|
||||
|
||||
it("the name is updated", () => {
|
||||
let childName = parentObject.name;
|
||||
childName = parentObject.name;
|
||||
|
||||
expect(childName).toEqual(NEW_NAME);
|
||||
});
|
||||
});
|
||||
|
@ -24,10 +24,15 @@ import {
|
||||
resetApplicationState
|
||||
} from 'utils/testing';
|
||||
|
||||
describe("the plugin", () => {
|
||||
describe("the goToOriginalAction plugin", () => {
|
||||
let openmct;
|
||||
let goToFolderAction;
|
||||
let goToOriginalAction;
|
||||
let mockRootFolder;
|
||||
let mockSubFolder;
|
||||
let mockSubSubFolder;
|
||||
let mockObject;
|
||||
let mockObjectPath;
|
||||
let hash;
|
||||
|
||||
beforeEach((done) => {
|
||||
openmct = createOpenMct();
|
||||
@ -35,7 +40,7 @@ describe("the plugin", () => {
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless();
|
||||
|
||||
goToFolderAction = openmct.actions._allActions.goToOriginal;
|
||||
goToOriginalAction = openmct.actions._allActions.goToOriginal;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -43,34 +48,153 @@ describe("the plugin", () => {
|
||||
});
|
||||
|
||||
it('installs the go to folder action', () => {
|
||||
expect(goToFolderAction).toBeDefined();
|
||||
expect(goToOriginalAction).toBeDefined();
|
||||
});
|
||||
|
||||
describe('when invoked', () => {
|
||||
beforeEach(() => {
|
||||
mockObjectPath = [{
|
||||
name: 'mock folder',
|
||||
type: 'folder',
|
||||
identifier: {
|
||||
key: 'mock-folder',
|
||||
namespace: ''
|
||||
}
|
||||
}];
|
||||
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({
|
||||
identifier: {
|
||||
namespace: '',
|
||||
key: 'test'
|
||||
}
|
||||
}));
|
||||
mockRootFolder = getMockObject('mock-root');
|
||||
mockSubFolder = getMockObject('mock-sub');
|
||||
mockSubSubFolder = getMockObject('mock-sub-sub');
|
||||
mockObject = getMockObject('mock-table');
|
||||
|
||||
goToFolderAction.invoke(mockObjectPath);
|
||||
mockObjectPath = [
|
||||
mockObject,
|
||||
mockSubSubFolder,
|
||||
mockSubFolder,
|
||||
mockRootFolder
|
||||
];
|
||||
|
||||
spyOn(openmct.objects, 'get').and.callFake(identifier => {
|
||||
const mockedObject = getMockObject(identifier);
|
||||
|
||||
return Promise.resolve(mockedObject);
|
||||
});
|
||||
|
||||
spyOn(openmct.router, 'navigate').and.callFake(navigateTo => {
|
||||
hash = navigateTo;
|
||||
});
|
||||
|
||||
return goToOriginalAction.invoke(mockObjectPath);
|
||||
});
|
||||
|
||||
it('goes to the original location', (done) => {
|
||||
setTimeout(() => {
|
||||
expect(window.location.href).toContain('context.html#/browse/?tc.mode=fixed&tc.startBound=0&tc.endBound=1&tc.timeSystem=utc');
|
||||
done();
|
||||
}, 1500);
|
||||
it('goes to the original location', () => {
|
||||
const originalLocationHash = '#/browse/mock-root/mock-table';
|
||||
|
||||
return waitForNavigation(() => {
|
||||
return hash === originalLocationHash;
|
||||
}).then(() => {
|
||||
expect(hash).toEqual(originalLocationHash);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function waitForNavigation(navigated) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const start = Date.now();
|
||||
|
||||
checkNavigated();
|
||||
|
||||
function checkNavigated() {
|
||||
const elapsed = Date.now() - start;
|
||||
|
||||
if (navigated()) {
|
||||
resolve();
|
||||
} else if (elapsed >= jasmine.DEFAULT_TIMEOUT_INTERVAL - 1000) {
|
||||
reject("didn't navigate in time");
|
||||
} else {
|
||||
setTimeout(checkNavigated);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMockObject(key) {
|
||||
const id = typeof key === 'string' ? key : key.key;
|
||||
|
||||
const mockMCTObjects = {
|
||||
"ROOT": {
|
||||
"composition": [
|
||||
{
|
||||
"namespace": "",
|
||||
"key": "mock-root"
|
||||
}
|
||||
],
|
||||
"identifier": {
|
||||
"namespace": "",
|
||||
"key": "mock-root"
|
||||
}
|
||||
},
|
||||
"mock-root": {
|
||||
"composition": [
|
||||
{
|
||||
"namespace": "",
|
||||
"key": "mock-sub"
|
||||
},
|
||||
{
|
||||
"namespace": "",
|
||||
"key": "mock-table"
|
||||
}
|
||||
],
|
||||
"name": "root",
|
||||
"type": "folder",
|
||||
"id": "mock-root",
|
||||
"location": "ROOT",
|
||||
"identifier": {
|
||||
"namespace": "",
|
||||
"key": "mock-root"
|
||||
}
|
||||
},
|
||||
"mock-sub": {
|
||||
"composition": [
|
||||
{
|
||||
"namespace": "",
|
||||
"key": "mock-sub-sub"
|
||||
},
|
||||
{
|
||||
"namespace": "",
|
||||
"key": "mock-table"
|
||||
}
|
||||
],
|
||||
"name": "sub",
|
||||
"type": "folder",
|
||||
"location": "mock-root",
|
||||
"identifier": {
|
||||
"namespace": "",
|
||||
"key": "mock-sub"
|
||||
}
|
||||
},
|
||||
"mock-table": {
|
||||
"composition": [],
|
||||
"configuration": {
|
||||
"columnWidths": {},
|
||||
"hiddenColumns": {}
|
||||
},
|
||||
"name": "table",
|
||||
"type": "table",
|
||||
"location": "mock-root",
|
||||
"identifier": {
|
||||
"namespace": "",
|
||||
"key": "mock-table"
|
||||
}
|
||||
},
|
||||
"mock-sub-sub": {
|
||||
"composition": [
|
||||
{
|
||||
"namespace": "",
|
||||
"key": "mock-table"
|
||||
}
|
||||
],
|
||||
"name": "sub sub",
|
||||
"type": "folder",
|
||||
"location": "mock-sub",
|
||||
"identifier": {
|
||||
"namespace": "",
|
||||
"key": "mock-sub-sub"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return mockMCTObjects[id];
|
||||
}
|
||||
});
|
||||
|
@ -30,10 +30,6 @@ describe('the plugin', function () {
|
||||
const TEST_NAMESPACE = 'test';
|
||||
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
openmct = createOpenMct();
|
||||
openmct.install(new InterceptorPlugin(openmct));
|
||||
|
||||
@ -46,7 +42,7 @@ describe('the plugin', function () {
|
||||
element.appendChild(child);
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless(appHolder);
|
||||
openmct.startHeadless();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -55,6 +51,7 @@ describe('the plugin', function () {
|
||||
|
||||
describe('the missingObjectInterceptor', () => {
|
||||
let mockProvider;
|
||||
|
||||
beforeEach(() => {
|
||||
mockProvider = jasmine.createSpyObj("mock provider", [
|
||||
"get"
|
||||
@ -63,27 +60,28 @@ describe('the plugin', function () {
|
||||
openmct.objects.addProvider(TEST_NAMESPACE, mockProvider);
|
||||
});
|
||||
|
||||
it('returns missing objects', (done) => {
|
||||
it('returns missing objects', () => {
|
||||
const identifier = {
|
||||
namespace: TEST_NAMESPACE,
|
||||
key: 'hello'
|
||||
};
|
||||
openmct.objects.get(identifier).then((testObject) => {
|
||||
|
||||
return openmct.objects.get(identifier).then((testObject) => {
|
||||
expect(testObject).toEqual({
|
||||
identifier,
|
||||
type: 'unknown',
|
||||
name: 'Missing: test:hello'
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the My items object if not found', (done) => {
|
||||
it('returns the My items object if not found', () => {
|
||||
const identifier = {
|
||||
namespace: TEST_NAMESPACE,
|
||||
key: 'mine'
|
||||
};
|
||||
openmct.objects.get(identifier).then((testObject) => {
|
||||
|
||||
return openmct.objects.get(identifier).then((testObject) => {
|
||||
expect(testObject).toEqual({
|
||||
identifier,
|
||||
"name": "My Items",
|
||||
@ -91,7 +89,6 @@ describe('the plugin', function () {
|
||||
"composition": [],
|
||||
"location": "ROOT"
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
import MoveActionPlugin from './plugin.js';
|
||||
import MoveAction from './MoveAction.js';
|
||||
import {
|
||||
createOpenMct,
|
||||
resetApplicationState,
|
||||
@ -37,10 +35,6 @@ describe("The Move Action plugin", () => {
|
||||
|
||||
// this setups up the app
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
openmct = createOpenMct();
|
||||
|
||||
childObject = getMockObjects({
|
||||
@ -73,11 +67,10 @@ describe("The Move Action plugin", () => {
|
||||
}
|
||||
}).folder;
|
||||
|
||||
// already installed by default, but never hurts, just adds to context menu
|
||||
openmct.install(MoveActionPlugin());
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless(appHolder);
|
||||
openmct.startHeadless();
|
||||
|
||||
moveAction = openmct.actions._allActions.move;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -85,13 +78,12 @@ describe("The Move Action plugin", () => {
|
||||
});
|
||||
|
||||
it("should be defined", () => {
|
||||
expect(MoveActionPlugin).toBeDefined();
|
||||
expect(moveAction).toBeDefined();
|
||||
});
|
||||
|
||||
describe("when moving an object to a new parent and removing from the old parent", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
moveAction = new MoveAction(openmct);
|
||||
moveAction.addToNewParent(childObject, anotherParentObject);
|
||||
moveAction.removeFromOldParent(parentObject, childObject);
|
||||
});
|
||||
|
@ -79,7 +79,7 @@ describe("the plugin", () => {
|
||||
spyOn(compositionAPI, 'get').and.returnValue(mockComposition);
|
||||
spyOn(openmct.objects, 'save').and.returnValue(Promise.resolve(true));
|
||||
|
||||
newFolderAction.invoke(mockObjectPath);
|
||||
return newFolderAction.invoke(mockObjectPath);
|
||||
});
|
||||
|
||||
it('gets user input for folder name', () => {
|
||||
|
@ -112,7 +112,7 @@ let openmct;
|
||||
let mockIdentifierService;
|
||||
|
||||
describe('Notebook Entries:', () => {
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
openmct = createOpenMct();
|
||||
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
||||
mockIdentifierService = jasmine.createSpyObj(
|
||||
@ -134,8 +134,6 @@ describe('Notebook Entries:', () => {
|
||||
'update'
|
||||
]));
|
||||
window.localStorage.setItem('notebook-storage', null);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -150,12 +148,11 @@ describe('Notebook Entries:', () => {
|
||||
expect(entries.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('addNotebookEntry adds entry', (done) => {
|
||||
it('addNotebookEntry adds entry', () => {
|
||||
const unlisten = openmct.objects.observe(notebookDomainObject, '*', (object) => {
|
||||
const entries = NotebookEntries.getNotebookEntries(notebookDomainObject, selectedSection, selectedPage);
|
||||
|
||||
expect(entries.length).toEqual(1);
|
||||
done();
|
||||
unlisten();
|
||||
});
|
||||
|
||||
|
@ -60,7 +60,7 @@ let openmct;
|
||||
let mockIdentifierService;
|
||||
|
||||
describe('Notebook Storage:', () => {
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
openmct = createOpenMct();
|
||||
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
||||
mockIdentifierService = jasmine.createSpyObj(
|
||||
@ -79,7 +79,6 @@ describe('Notebook Storage:', () => {
|
||||
'create',
|
||||
'update'
|
||||
]));
|
||||
done();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -29,9 +29,10 @@ describe('the plugin', function () {
|
||||
let element;
|
||||
let child;
|
||||
let openmct;
|
||||
let appHolder;
|
||||
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
@ -103,7 +104,7 @@ describe('the plugin', function () {
|
||||
];
|
||||
let planView;
|
||||
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
planDomainObject = {
|
||||
identifier: {
|
||||
key: 'test-object',
|
||||
@ -140,9 +141,7 @@ describe('the plugin', function () {
|
||||
let view = planView.view(planDomainObject, mockObjectPath);
|
||||
view.show(child, true);
|
||||
|
||||
return Vue.nextTick().then(() => {
|
||||
done();
|
||||
});
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
it('loads activities into the view', () => {
|
||||
|
@ -34,6 +34,7 @@ describe("the plugin", function () {
|
||||
let child;
|
||||
let openmct;
|
||||
let telemetryPromise;
|
||||
let telemetryPromiseResolve;
|
||||
let cleanupFirst;
|
||||
let mockObjectPath;
|
||||
let telemetrylimitProvider;
|
||||
@ -78,7 +79,6 @@ describe("the plugin", function () {
|
||||
|
||||
openmct = createOpenMct();
|
||||
|
||||
let telemetryPromiseResolve;
|
||||
telemetryPromise = new Promise((resolve) => {
|
||||
telemetryPromiseResolve = resolve;
|
||||
});
|
||||
|
@ -19,8 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
import RemoveActionPlugin from './plugin.js';
|
||||
import RemoveAction from './RemoveAction.js';
|
||||
import {
|
||||
createOpenMct,
|
||||
resetApplicationState,
|
||||
@ -36,10 +34,6 @@ describe("The Remove Action plugin", () => {
|
||||
|
||||
// this setups up the app
|
||||
beforeEach((done) => {
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
openmct = createOpenMct();
|
||||
|
||||
childObject = getMockObjects({
|
||||
@ -64,11 +58,10 @@ describe("The Remove Action plugin", () => {
|
||||
}
|
||||
}).folder;
|
||||
|
||||
// already installed by default, but never hurts, just adds to context menu
|
||||
openmct.install(RemoveActionPlugin());
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless(appHolder);
|
||||
openmct.startHeadless();
|
||||
|
||||
removeAction = openmct.actions._allActions.remove;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -76,13 +69,12 @@ describe("The Remove Action plugin", () => {
|
||||
});
|
||||
|
||||
it("should be defined", () => {
|
||||
expect(RemoveActionPlugin).toBeDefined();
|
||||
expect(removeAction).toBeDefined();
|
||||
});
|
||||
|
||||
describe("when removing an object from a parent composition", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
removeAction = new RemoveAction(openmct);
|
||||
spyOn(removeAction, 'removeFromComposition').and.callThrough();
|
||||
spyOn(removeAction, 'inNavigationPath').and.returnValue(false);
|
||||
spyOn(openmct.objects, 'mutate').and.callThrough();
|
||||
@ -103,7 +95,6 @@ describe("The Remove Action plugin", () => {
|
||||
describe("when determining the object is applicable", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
removeAction = new RemoveAction(openmct);
|
||||
spyOn(removeAction, 'appliesTo').and.callThrough();
|
||||
});
|
||||
|
||||
|
@ -113,7 +113,7 @@ describe('the plugin', function () {
|
||||
let tabsLayoutViewProvider;
|
||||
let mockComposition;
|
||||
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
mockComposition = new EventEmitter();
|
||||
mockComposition.load = () => {
|
||||
return Promise.resolve([telemetryItem1]);
|
||||
@ -125,7 +125,8 @@ describe('the plugin', function () {
|
||||
tabsLayoutViewProvider = applicableViews.find((viewProvider) => viewProvider.key === 'tabs');
|
||||
let view = tabsLayoutViewProvider.view(testViewObject, []);
|
||||
view.show(child, true);
|
||||
Vue.nextTick(done);
|
||||
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
it('provides a view', () => {
|
||||
@ -150,7 +151,7 @@ describe('the plugin', function () {
|
||||
let mockComposition;
|
||||
let count = 0;
|
||||
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
mockComposition = new EventEmitter();
|
||||
mockComposition.load = () => {
|
||||
if (count === 0) {
|
||||
@ -168,7 +169,8 @@ describe('the plugin', function () {
|
||||
tabsLayoutViewProvider = applicableViews.find((viewProvider) => viewProvider.key === 'tabs');
|
||||
let view = tabsLayoutViewProvider.view(testViewObject, []);
|
||||
view.show(child, true);
|
||||
Vue.nextTick(done);
|
||||
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
it ('renders a tab for each item', () => {
|
||||
|
@ -50,9 +50,6 @@ describe('the plugin', function () {
|
||||
}
|
||||
}
|
||||
];
|
||||
const appHolder = document.createElement('div');
|
||||
appHolder.style.width = '640px';
|
||||
appHolder.style.height = '480px';
|
||||
|
||||
openmct = createOpenMct();
|
||||
openmct.install(new TimelinePlugin());
|
||||
@ -73,7 +70,7 @@ describe('the plugin', function () {
|
||||
});
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless(appHolder);
|
||||
openmct.startHeadless();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -100,7 +97,7 @@ describe('the plugin', function () {
|
||||
describe('the view', () => {
|
||||
let timelineView;
|
||||
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
const testViewObject = {
|
||||
id: "test-object",
|
||||
type: "time-strip"
|
||||
@ -110,7 +107,8 @@ describe('the plugin', function () {
|
||||
timelineView = applicableViews.find((viewProvider) => viewProvider.key === 'time-strip.view');
|
||||
let view = timelineView.view(testViewObject, element);
|
||||
view.show(child, true);
|
||||
Vue.nextTick(done);
|
||||
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
it('provides a view', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user