fix unit tests

This commit is contained in:
David Tsay 2020-04-06 14:25:55 -07:00
parent d41fc27b55
commit e0c5bca47d
2 changed files with 15 additions and 1 deletions

View File

@ -49,6 +49,7 @@ describe('ConditionManager', () => {
}; };
let mockComposition; let mockComposition;
let loader; let loader;
let mockTimeSystems;
function mockAngularComponents() { function mockAngularComponents() {
let mockInjector = jasmine.createSpyObj('$injector', ['get']); let mockInjector = jasmine.createSpyObj('$injector', ['get']);
@ -111,6 +112,12 @@ describe('ConditionManager', () => {
openmct.objects.observe.and.returnValue(function () {}); openmct.objects.observe.and.returnValue(function () {});
openmct.objects.mutate.and.returnValue(function () {}); openmct.objects.mutate.and.returnValue(function () {});
mockTimeSystems = {
key: 'utc'
};
openmct.time = jasmine.createSpyObj('time', ['getAllTimeSystems']);
openmct.time.getAllTimeSystems.and.returnValue([mockTimeSystems]);
conditionMgr = new ConditionManager(conditionSetDomainObject, openmct); conditionMgr = new ConditionManager(conditionSetDomainObject, openmct);
conditionMgr.on('conditionSetResultUpdated', mockListener); conditionMgr.on('conditionSetResultUpdated', mockListener);

View File

@ -30,7 +30,8 @@ let openmct = {},
testTelemetryObject, testTelemetryObject,
conditionObj, conditionObj,
conditionManager, conditionManager,
mockBroadcastTelemetry; mockBroadcastTelemetry,
mockTimeSystems;
describe("The condition", function () { describe("The condition", function () {
@ -74,6 +75,12 @@ describe("The condition", function () {
openmct.telemetry.subscribe.and.returnValue(function () {}); openmct.telemetry.subscribe.and.returnValue(function () {});
openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry.values); openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry.values);
mockTimeSystems = {
key: 'utc'
};
openmct.time = jasmine.createSpyObj('time', ['getAllTimeSystems']);
openmct.time.getAllTimeSystems.and.returnValue([mockTimeSystems]);
testConditionDefinition = { testConditionDefinition = {
id: '123-456', id: '123-456',
configuration: { configuration: {