mirror of
https://github.com/nasa/openmct.git
synced 2025-02-08 12:00:38 +00:00
Adds tests for condition class
This commit is contained in:
parent
91c877f234
commit
5d8252bb07
@ -175,6 +175,7 @@ export default class Condition extends EventEmitter {
|
|||||||
//TODO: implement as part of the evaluator class task.
|
//TODO: implement as part of the evaluator class task.
|
||||||
evaluate() {
|
evaluate() {
|
||||||
if (this.trigger === TRIGGER.ANY) {
|
if (this.trigger === TRIGGER.ANY) {
|
||||||
|
criteria.evaluate();
|
||||||
this.result = false;
|
this.result = false;
|
||||||
} else if (this.trigger === TRIGGER.ALL) {
|
} else if (this.trigger === TRIGGER.ALL) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
|
@ -57,8 +57,9 @@ describe("The condition", function () {
|
|||||||
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||||
openmct.objects.get.and.returnValue(testTelemetryObject);
|
openmct.objects.get.and.returnValue(testTelemetryObject);
|
||||||
openmct.objects.makeKeyString.and.returnValue(testTelemetryObject.identifier.key);
|
openmct.objects.makeKeyString.and.returnValue(testTelemetryObject.identifier.key);
|
||||||
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject']);
|
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject', 'subscribe']);
|
||||||
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
||||||
|
openmct.telemetry.subscribe.and.returnValue(function () {});
|
||||||
|
|
||||||
testConditionDefinition = {
|
testConditionDefinition = {
|
||||||
trigger: TRIGGER.ANY,
|
trigger: TRIGGER.ANY,
|
||||||
@ -108,4 +109,10 @@ describe("The condition", function () {
|
|||||||
it("initializes with the trigger from the condition definition", function () {
|
it("initializes with the trigger from the condition definition", function () {
|
||||||
expect(conditionObj.trigger).toEqual(testConditionDefinition.trigger);
|
expect(conditionObj.trigger).toEqual(testConditionDefinition.trigger);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("destroys all criteria for a condition", function () {
|
||||||
|
const result = conditionObj.destroyCriteria();
|
||||||
|
expect(result).toBeTrue();
|
||||||
|
expect(conditionObj.criteria.length).toEqual(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
0
src/plugins/condition/StyleRuleManager.js
Normal file
0
src/plugins/condition/StyleRuleManager.js
Normal file
Loading…
x
Reference in New Issue
Block a user