mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 00:57:11 +00:00
Fixes condition plugin tests
This commit is contained in:
@ -23,18 +23,51 @@
|
|||||||
import { createOpenMct } from "testTools";
|
import { createOpenMct } from "testTools";
|
||||||
import ConditionPlugin from "./plugin";
|
import ConditionPlugin from "./plugin";
|
||||||
|
|
||||||
let openmct;
|
let openmct = createOpenMct();
|
||||||
|
openmct.install(new ConditionPlugin());
|
||||||
|
|
||||||
let conditionDefinition;
|
let conditionDefinition;
|
||||||
let conditionSetDefinition;
|
let conditionSetDefinition;
|
||||||
let mockDomainObject;
|
let mockDomainObject;
|
||||||
|
let mockDomainObject2;
|
||||||
|
let element;
|
||||||
|
let child;
|
||||||
|
|
||||||
describe('the plugin', function () {
|
describe('the plugin', function () {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeAll((done) => {
|
||||||
openmct = createOpenMct();
|
|
||||||
openmct.install(new ConditionPlugin());
|
|
||||||
conditionDefinition = openmct.types.get('condition').definition;
|
conditionDefinition = openmct.types.get('condition').definition;
|
||||||
|
mockDomainObject = {
|
||||||
|
identifier: {
|
||||||
|
key: 'testConditionKey',
|
||||||
|
namespace: ''
|
||||||
|
},
|
||||||
|
type: 'condition'
|
||||||
|
};
|
||||||
|
|
||||||
|
conditionDefinition.initialize(mockDomainObject);
|
||||||
|
|
||||||
conditionSetDefinition = openmct.types.get('conditionSet').definition;
|
conditionSetDefinition = openmct.types.get('conditionSet').definition;
|
||||||
|
const appHolder = document.createElement('div');
|
||||||
|
appHolder.style.width = '640px';
|
||||||
|
appHolder.style.height = '480px';
|
||||||
|
|
||||||
|
element = document.createElement('div');
|
||||||
|
child = document.createElement('div');
|
||||||
|
element.appendChild(child);
|
||||||
|
|
||||||
|
mockDomainObject2 = {
|
||||||
|
identifier: {
|
||||||
|
key: 'testConditionSetKey',
|
||||||
|
namespace: ''
|
||||||
|
},
|
||||||
|
type: 'conditionSet'
|
||||||
|
};
|
||||||
|
|
||||||
|
conditionSetDefinition.initialize(mockDomainObject2);
|
||||||
|
|
||||||
|
openmct.on('start', done);
|
||||||
|
openmct.start(appHolder);
|
||||||
});
|
});
|
||||||
|
|
||||||
let mockConditionObject = {
|
let mockConditionObject = {
|
||||||
@ -58,17 +91,6 @@ describe('the plugin', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('the condition object', () => {
|
describe('the condition object', () => {
|
||||||
beforeEach(() => {
|
|
||||||
mockDomainObject = {
|
|
||||||
identifier: {
|
|
||||||
key: 'testConditionKey',
|
|
||||||
namespace: ''
|
|
||||||
},
|
|
||||||
type: 'condition'
|
|
||||||
};
|
|
||||||
|
|
||||||
conditionDefinition.initialize(mockDomainObject);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not creatable', () => {
|
it('is not creatable', () => {
|
||||||
expect(conditionDefinition.creatable).toEqual(mockConditionObject.creatable);
|
expect(conditionDefinition.creatable).toEqual(mockConditionObject.creatable);
|
||||||
@ -81,39 +103,14 @@ describe('the plugin', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('the conditionSet object', () => {
|
describe('the conditionSet object', () => {
|
||||||
let element;
|
|
||||||
let child;
|
|
||||||
|
|
||||||
beforeEach((done) => {
|
it('is creatable', () => {
|
||||||
const appHolder = document.createElement('div');
|
|
||||||
appHolder.style.width = '640px';
|
|
||||||
appHolder.style.height = '480px';
|
|
||||||
|
|
||||||
element = document.createElement('div');
|
|
||||||
child = document.createElement('div');
|
|
||||||
element.appendChild(child);
|
|
||||||
|
|
||||||
mockDomainObject = {
|
|
||||||
identifier: {
|
|
||||||
key: 'testConditionSetKey',
|
|
||||||
namespace: ''
|
|
||||||
},
|
|
||||||
type: 'conditionSet'
|
|
||||||
};
|
|
||||||
|
|
||||||
conditionSetDefinition.initialize(mockDomainObject);
|
|
||||||
|
|
||||||
openmct.on('start', done);
|
|
||||||
openmct.start(appHolder);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not creatable', () => {
|
|
||||||
expect(conditionSetDefinition.creatable).toEqual(mockConditionSetObject.creatable);
|
expect(conditionSetDefinition.creatable).toEqual(mockConditionSetObject.creatable);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('initializes with an empty composition list', () => {
|
it('initializes with an empty composition list', () => {
|
||||||
expect(mockDomainObject.composition instanceof Array).toBeTrue();
|
expect(mockDomainObject2.composition instanceof Array).toBeTrue();
|
||||||
expect(mockDomainObject.composition.length).toEqual(0);
|
expect(mockDomainObject2.composition.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('provides a view', () => {
|
it('provides a view', () => {
|
||||||
|
Reference in New Issue
Block a user