refactor conditionSet pluginSpec

This commit is contained in:
Joel McKinnon 2019-12-19 11:14:55 -08:00
parent 5d3ba3199c
commit c7946fd7b3
3 changed files with 21 additions and 32 deletions

4
app.js
View File

@ -15,11 +15,7 @@ const fs = require('fs');
const request = require('request');
// Defaults
<<<<<<< HEAD
options.port = options.port || options.p || 8070;
=======
options.port = options.port || options.p || 8080;
>>>>>>> 656d6d6c3f0701f9afceb01c358eb047bd351bb2
options.host = options.host || 'localhost';
options.directory = options.directory || options.D || '.';

View File

@ -30,7 +30,6 @@ export default function plugin() {
cssClass: 'icon-folder',
initialize: function (domainObject) {
domainObject.composition = [];
// domainObject.telemetry = {};
}
};

View File

@ -20,46 +20,40 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import ConditionSetPlugin from './plugin';
import { createOpenMct } from 'testTools';
import ConditionSetPlugin from './plugin';
describe("The plugin", () => {
fdescribe('The plugin', () => {
let openmct;
let mockDomainObject;
let conditionSetDefinition;
beforeEach(() => {
openmct = createOpenMct();
openmct.install(new ConditionSetPlugin());
mockDomainObject = {
identifier: {
key: 'testKey',
namespace: ''
},
type: 'conditionSet'
};
conditionSetDefinition = openmct.types.get('conditionSet').definition;
});
it('defines a conditionSet object type with the correct key', () => {
expect(openmct.types.get('conditionSet').definition.key).toEqual('conditionSet');
it('defines an object type with the correct key', () => {
expect(conditionSetDefinition.key).toEqual('conditionSet');
});
it('defines a conditionSet object type that is creatable', () => {
expect(openmct.types.get('conditionSet').definition.creatable).toBeTrue();
it('defines an object type that is creatable', () => {
expect(conditionSetDefinition.creatable).toBeTrue();
});
describe("shows the conditionSet object is initialized with", () => {
beforeEach(() => {
openmct.types.get('conditionSet').definition.initialize(mockDomainObject);
describe('The object', () => {
it('initializes with an empty composition list', () => {
let mockDomainObject = {
identifier: {
key: 'testConditionSetKey',
namespace: ''
},
type: 'conditionSet'
};
conditionSetDefinition.initialize(mockDomainObject);
expect(mockDomainObject.composition instanceof Array).toBeTrue();
expect(mockDomainObject.composition.length).toEqual(0);
});
it('a composition array', () => {
expect(Array.isArray(mockDomainObject.composition)).toBeTrue();
});
// it('a telemetry object', () => {
// expect(typeof mockDomainObject.telemetry === 'object').toBeTrue();
// });
});
});