mirror of
https://github.com/nasa/openmct.git
synced 2025-03-10 22:43:55 +00:00
Merge branch 'topic-conditionals' of https://github.com/nasa/openmct into condition-class
This commit is contained in:
commit
8ca202d0a9
@ -24,15 +24,15 @@ import * as EventEmitter from 'eventemitter3';
|
||||
|
||||
export default class TelemetryCriterion extends EventEmitter {
|
||||
|
||||
constructor(telemetryDomainObject, openmct) {
|
||||
constructor(telemetryDomainObjectKey, openmct) {
|
||||
super();
|
||||
|
||||
this.telemetryObject = telemetryDomainObject;
|
||||
this.openmct = openmct;
|
||||
this.telemetryObject = this.openmct.objects.get(this.openmct.objects.makeKeyString(telemetryDomainObjectKey));
|
||||
this.telemetryAPI = this.openmct.telemetry;
|
||||
this.subscription = null;
|
||||
this.telemetryObjectIdAsString = null;
|
||||
this.telemetryMetadata = null;
|
||||
this.telemetryObjectIdAsString = null;
|
||||
if (this.telemetryAPI.isTelemetryObject(this.telemetryObject)) {
|
||||
this.telemetryObjectIdAsString = this.openmct.objects.makeKeyString(this.telemetryObject.identifier);
|
||||
}
|
||||
@ -52,7 +52,7 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
}
|
||||
|
||||
emitResult(data, error) {
|
||||
this.emit('criterion::Update', {
|
||||
this.emit('criterionUpdated', {
|
||||
identifier: this.telemetryObjectIdAsString,
|
||||
data: data,
|
||||
error: error
|
||||
|
@ -21,9 +21,8 @@
|
||||
*****************************************************************************/
|
||||
|
||||
import TelemetryCriterion from "./TelemetryCriterion";
|
||||
import { createOpenMct } from "../../../testTools";
|
||||
|
||||
let openmct,
|
||||
let openmct = {},
|
||||
mockListener,
|
||||
testTelemetryObject,
|
||||
telemetryCriterion;
|
||||
@ -31,8 +30,6 @@ let openmct,
|
||||
describe("The telemetry criterion", function () {
|
||||
|
||||
beforeEach (() => {
|
||||
openmct = createOpenMct();
|
||||
mockListener = jasmine.createSpy('listener');
|
||||
testTelemetryObject = {
|
||||
identifier:{ namespace: "", key: "test-object"},
|
||||
type: "test-object",
|
||||
@ -53,13 +50,21 @@ describe("The telemetry criterion", 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', "subscribe"]);
|
||||
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
||||
openmct.telemetry.subscribe.and.returnValue(function () {});
|
||||
|
||||
mockListener = jasmine.createSpy('listener');
|
||||
|
||||
telemetryCriterion = new TelemetryCriterion(
|
||||
testTelemetryObject,
|
||||
testTelemetryObject.identifier,
|
||||
openmct
|
||||
);
|
||||
|
||||
telemetryCriterion.on('criterion::Update', mockListener);
|
||||
telemetryCriterion.on('criterionUpdated', mockListener);
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user