mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 16:58:04 +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.
|
||||
evaluate() {
|
||||
if (this.trigger === TRIGGER.ANY) {
|
||||
criteria.evaluate();
|
||||
this.result = false;
|
||||
} else if (this.trigger === TRIGGER.ALL) {
|
||||
this.result = false;
|
||||
|
@ -57,8 +57,9 @@ describe("The condition", function () {
|
||||
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||
openmct.objects.get.and.returnValue(testTelemetryObject);
|
||||
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.subscribe.and.returnValue(function () {});
|
||||
|
||||
testConditionDefinition = {
|
||||
trigger: TRIGGER.ANY,
|
||||
@ -108,4 +109,10 @@ describe("The condition", function () {
|
||||
it("initializes with the trigger from the condition definition", function () {
|
||||
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