mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 09:58:52 +00:00
Fixes unit tests
This commit is contained in:
parent
fcca8fa8d9
commit
0a634eb490
@ -62,6 +62,9 @@ describe("The condition", function () {
|
||||
}]
|
||||
}
|
||||
};
|
||||
conditionManager.telemetryObjects = {
|
||||
"test-object": testTelemetryObject
|
||||
};
|
||||
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||
openmct.objects.get.and.returnValue(new Promise(function (resolve, reject) {
|
||||
resolve(testTelemetryObject);
|
||||
|
@ -24,7 +24,6 @@ import TelemetryCriterion from "./TelemetryCriterion";
|
||||
|
||||
let openmct = {},
|
||||
mockListener,
|
||||
mockListener2,
|
||||
testCriterionDefinition,
|
||||
testTelemetryObject,
|
||||
telemetryCriterion;
|
||||
@ -60,9 +59,6 @@ describe("The telemetry criterion", function () {
|
||||
}
|
||||
};
|
||||
openmct.objects = jasmine.createSpyObj('objects', ['get', 'makeKeyString']);
|
||||
openmct.objects.get.and.returnValue(new Promise(function (resolve, reject) {
|
||||
resolve(testTelemetryObject);
|
||||
}));
|
||||
openmct.objects.makeKeyString.and.returnValue(testTelemetryObject.identifier.key);
|
||||
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject', "subscribe", "getMetadata"]);
|
||||
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
||||
@ -80,13 +76,11 @@ describe("The telemetry criterion", function () {
|
||||
id: 'test-criterion-id',
|
||||
telemetry: openmct.objects.makeKeyString(testTelemetryObject.identifier),
|
||||
operation: 'lessThan',
|
||||
metadata: 'sin'
|
||||
metadata: 'sin',
|
||||
telemetryObject: testTelemetryObject
|
||||
};
|
||||
|
||||
mockListener = jasmine.createSpy('listener');
|
||||
mockListener2 = jasmine.createSpy('updatedListener', (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
telemetryCriterion = new TelemetryCriterion(
|
||||
testCriterionDefinition,
|
||||
@ -94,18 +88,14 @@ describe("The telemetry criterion", function () {
|
||||
);
|
||||
|
||||
telemetryCriterion.on('criterionResultUpdated', mockListener);
|
||||
telemetryCriterion.on('criterionUpdated', mockListener2);
|
||||
|
||||
});
|
||||
|
||||
it("initializes with a telemetry objectId as string", function () {
|
||||
telemetryCriterion.initialize(testTelemetryObject);
|
||||
expect(telemetryCriterion.telemetryObjectIdAsString).toEqual(testTelemetryObject.identifier.key);
|
||||
expect(mockListener2).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates and emits event on new data from telemetry providers", function () {
|
||||
telemetryCriterion.initialize(testTelemetryObject);
|
||||
spyOn(telemetryCriterion, 'emitEvent').and.callThrough();
|
||||
telemetryCriterion.handleSubscription({
|
||||
value: 'Hello',
|
||||
|
Loading…
Reference in New Issue
Block a user