mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 23:28:14 +00:00
[Time Controller] Update failing specs
Update failing specs to reflect support for time conductor, WTD-1515
This commit is contained in:
@ -83,7 +83,7 @@ define(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("simply delegates subscribe calls", function () {
|
it("adds start/end times to subscribe calls", function () {
|
||||||
var mockCallback = jasmine.createSpy('callback'),
|
var mockCallback = jasmine.createSpy('callback'),
|
||||||
testRequest = { someKey: "some value" };
|
testRequest = { someKey: "some value" };
|
||||||
expect(conductorTelemetryCapability.subscribe(
|
expect(conductorTelemetryCapability.subscribe(
|
||||||
@ -92,7 +92,11 @@ define(
|
|||||||
)).toBe(mockUnsubscribe);
|
)).toBe(mockUnsubscribe);
|
||||||
expect(mockTelemetryCapability.subscribe).toHaveBeenCalledWith(
|
expect(mockTelemetryCapability.subscribe).toHaveBeenCalledWith(
|
||||||
mockCallback,
|
mockCallback,
|
||||||
{ someKey: "some value" }
|
{
|
||||||
|
someKey: "some value",
|
||||||
|
start: testStartTime,
|
||||||
|
end: testEndTime
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ define(
|
|||||||
var mockScope,
|
var mockScope,
|
||||||
mockQ,
|
mockQ,
|
||||||
mockDialogService,
|
mockDialogService,
|
||||||
mockSubscriber,
|
mockHandler,
|
||||||
mockFormatter,
|
mockFormatter,
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
mockSubscription,
|
mockHandle,
|
||||||
mockEvent,
|
mockEvent,
|
||||||
testGrid,
|
testGrid,
|
||||||
testModel,
|
testModel,
|
||||||
@ -78,9 +78,9 @@ define(
|
|||||||
'$scope',
|
'$scope',
|
||||||
[ "$on", "$watch", "commit" ]
|
[ "$on", "$watch", "commit" ]
|
||||||
);
|
);
|
||||||
mockSubscriber = jasmine.createSpyObj(
|
mockHandler = jasmine.createSpyObj(
|
||||||
'telemetrySubscriber',
|
'telemetryHandler',
|
||||||
[ 'subscribe' ]
|
[ 'handle' ]
|
||||||
);
|
);
|
||||||
mockQ = jasmine.createSpyObj('$q', ['when']);
|
mockQ = jasmine.createSpyObj('$q', ['when']);
|
||||||
mockDialogService = jasmine.createSpyObj(
|
mockDialogService = jasmine.createSpyObj(
|
||||||
@ -95,9 +95,15 @@ define(
|
|||||||
'domainObject',
|
'domainObject',
|
||||||
[ 'getId', 'getModel', 'getCapability' ]
|
[ 'getId', 'getModel', 'getCapability' ]
|
||||||
);
|
);
|
||||||
mockSubscription = jasmine.createSpyObj(
|
mockHandle = jasmine.createSpyObj(
|
||||||
'subscription',
|
'subscription',
|
||||||
[ 'unsubscribe', 'getTelemetryObjects', 'getRangeValue', 'getDatum' ]
|
[
|
||||||
|
'unsubscribe',
|
||||||
|
'getDomainValue',
|
||||||
|
'getTelemetryObjects',
|
||||||
|
'getRangeValue',
|
||||||
|
'getDatum'
|
||||||
|
]
|
||||||
);
|
);
|
||||||
mockEvent = jasmine.createSpyObj(
|
mockEvent = jasmine.createSpyObj(
|
||||||
'event',
|
'event',
|
||||||
@ -116,13 +122,14 @@ define(
|
|||||||
{ type: "fixed.telemetry", id: 'c', x: 1, y: 1 }
|
{ type: "fixed.telemetry", id: 'c', x: 1, y: 1 }
|
||||||
]};
|
]};
|
||||||
|
|
||||||
mockSubscriber.subscribe.andReturn(mockSubscription);
|
mockHandler.handle.andReturn(mockHandle);
|
||||||
mockSubscription.getTelemetryObjects.andReturn(
|
mockHandle.getTelemetryObjects.andReturn(
|
||||||
testModel.composition.map(makeMockDomainObject)
|
testModel.composition.map(makeMockDomainObject)
|
||||||
);
|
);
|
||||||
mockSubscription.getRangeValue.andCallFake(function (o) {
|
mockHandle.getRangeValue.andCallFake(function (o) {
|
||||||
return testValues[o.getId()];
|
return testValues[o.getId()];
|
||||||
});
|
});
|
||||||
|
mockHandle.getDomainValue.andReturn(12321);
|
||||||
mockFormatter.formatRangeValue.andCallFake(function (v) {
|
mockFormatter.formatRangeValue.andCallFake(function (v) {
|
||||||
return "Formatted " + v;
|
return "Formatted " + v;
|
||||||
});
|
});
|
||||||
@ -137,7 +144,7 @@ define(
|
|||||||
mockScope,
|
mockScope,
|
||||||
mockQ,
|
mockQ,
|
||||||
mockDialogService,
|
mockDialogService,
|
||||||
mockSubscriber,
|
mockHandler,
|
||||||
mockFormatter
|
mockFormatter
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -145,7 +152,7 @@ define(
|
|||||||
it("subscribes when a domain object is available", function () {
|
it("subscribes when a domain object is available", function () {
|
||||||
mockScope.domainObject = mockDomainObject;
|
mockScope.domainObject = mockDomainObject;
|
||||||
findWatch("domainObject")(mockDomainObject);
|
findWatch("domainObject")(mockDomainObject);
|
||||||
expect(mockSubscriber.subscribe).toHaveBeenCalledWith(
|
expect(mockHandler.handle).toHaveBeenCalledWith(
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
jasmine.any(Function)
|
jasmine.any(Function)
|
||||||
);
|
);
|
||||||
@ -156,13 +163,13 @@ define(
|
|||||||
|
|
||||||
// First pass - should simply should subscribe
|
// First pass - should simply should subscribe
|
||||||
findWatch("domainObject")(mockDomainObject);
|
findWatch("domainObject")(mockDomainObject);
|
||||||
expect(mockSubscription.unsubscribe).not.toHaveBeenCalled();
|
expect(mockHandle.unsubscribe).not.toHaveBeenCalled();
|
||||||
expect(mockSubscriber.subscribe.calls.length).toEqual(1);
|
expect(mockHandler.handle.calls.length).toEqual(1);
|
||||||
|
|
||||||
// Object changes - should unsubscribe then resubscribe
|
// Object changes - should unsubscribe then resubscribe
|
||||||
findWatch("domainObject")(mockDomainObject);
|
findWatch("domainObject")(mockDomainObject);
|
||||||
expect(mockSubscription.unsubscribe).toHaveBeenCalled();
|
expect(mockHandle.unsubscribe).toHaveBeenCalled();
|
||||||
expect(mockSubscriber.subscribe.calls.length).toEqual(2);
|
expect(mockHandler.handle.calls.length).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("exposes visible elements based on configuration", function () {
|
it("exposes visible elements based on configuration", function () {
|
||||||
@ -255,7 +262,7 @@ define(
|
|||||||
findWatch("model.composition")(mockScope.model.composition);
|
findWatch("model.composition")(mockScope.model.composition);
|
||||||
|
|
||||||
// Invoke the subscription callback
|
// Invoke the subscription callback
|
||||||
mockSubscriber.subscribe.mostRecentCall.args[1]();
|
mockHandler.handle.mostRecentCall.args[1]();
|
||||||
|
|
||||||
// Get elements that controller is now exposing
|
// Get elements that controller is now exposing
|
||||||
elements = controller.getElements();
|
elements = controller.getElements();
|
||||||
@ -333,11 +340,11 @@ define(
|
|||||||
// Make an object available
|
// Make an object available
|
||||||
findWatch('domainObject')(mockDomainObject);
|
findWatch('domainObject')(mockDomainObject);
|
||||||
// Also verify precondition
|
// Also verify precondition
|
||||||
expect(mockSubscription.unsubscribe).not.toHaveBeenCalled();
|
expect(mockHandle.unsubscribe).not.toHaveBeenCalled();
|
||||||
// Destroy the scope
|
// Destroy the scope
|
||||||
findOn('$destroy')();
|
findOn('$destroy')();
|
||||||
// Should have unsubscribed
|
// Should have unsubscribed
|
||||||
expect(mockSubscription.unsubscribe).toHaveBeenCalled();
|
expect(mockHandle.unsubscribe).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("exposes its grid size", function () {
|
it("exposes its grid size", function () {
|
||||||
|
Reference in New Issue
Block a user