mirror of
https://github.com/nasa/openmct.git
synced 2025-02-10 21:01:31 +00:00
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
|
import { createOpenMct } from "testTools";
|
||
|
import ConditionPlugin from "./plugin";
|
||
|
|
||
|
let openmct;
|
||
|
let conditionDefinition;
|
||
|
let mockDomainObject;
|
||
|
|
||
|
let mockConditionObject = {
|
||
|
name: 'Condition',
|
||
|
key: 'condition',
|
||
|
creatable: false
|
||
|
};
|
||
|
|
||
|
describe('the plugin', function () {
|
||
|
|
||
|
beforeEach(() => {
|
||
|
openmct = createOpenMct();
|
||
|
openmct.install(new ConditionPlugin());
|
||
|
conditionDefinition = openmct.types.get('condition').definition;
|
||
|
});
|
||
|
|
||
|
it('defines an object type with the correct key', () => {
|
||
|
expect(conditionDefinition.key).toEqual(mockConditionObject.key);
|
||
|
});
|
||
|
|
||
|
it('is not creatable', () => {
|
||
|
expect(conditionDefinition.creatable).toEqual(mockConditionObject.creatable);
|
||
|
});
|
||
|
|
||
|
describe('the object', () => {
|
||
|
beforeEach(() => {
|
||
|
mockDomainObject = {
|
||
|
identifier: {
|
||
|
key: 'testConditionKey',
|
||
|
namespace: ''
|
||
|
},
|
||
|
type: 'condition'
|
||
|
};
|
||
|
|
||
|
conditionDefinition.initialize(mockDomainObject);
|
||
|
});
|
||
|
|
||
|
it('initializes with an empty composition list', () => {
|
||
|
expect(mockDomainObject.composition instanceof Array).toBeTrue();
|
||
|
expect(mockDomainObject.composition.length).toEqual(0);
|
||
|
});
|
||
|
});
|
||
|
});
|