mirror of
https://github.com/nasa/openmct.git
synced 2025-06-02 07:30:49 +00:00
[Telemetry] Update specs for coverage
Cover code added to TelemetryController to handle subscriptions to streaming telemetry, added to support WTD-644, connection to the WARP Server.
This commit is contained in:
parent
12c4863feb
commit
63990b5e13
@ -190,6 +190,16 @@ define(
|
|||||||
.toHaveBeenCalledWith("telemetryUpdate");
|
.toHaveBeenCalledWith("telemetryUpdate");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("subscribes for streaming telemetry updates", function () {
|
||||||
|
// Push into scope to create subscriptions
|
||||||
|
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||||
|
// Should have subscribed
|
||||||
|
expect(mockTelemetry.subscribe)
|
||||||
|
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||||
|
// Invoke the subscriber function (for coverage)
|
||||||
|
mockTelemetry.subscribe.mostRecentCall.args[0]({});
|
||||||
|
});
|
||||||
|
|
||||||
it("listens for scope destruction to clean up", function () {
|
it("listens for scope destruction to clean up", function () {
|
||||||
expect(mockScope.$on).toHaveBeenCalledWith(
|
expect(mockScope.$on).toHaveBeenCalledWith(
|
||||||
"$destroy",
|
"$destroy",
|
||||||
@ -198,6 +208,16 @@ define(
|
|||||||
mockScope.$on.mostRecentCall.args[1]();
|
mockScope.$on.mostRecentCall.args[1]();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("unsubscribes when destroyed", function () {
|
||||||
|
// Push into scope to create subscriptions
|
||||||
|
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||||
|
|
||||||
|
// Invoke "$destroy" listener
|
||||||
|
mockScope.$on.mostRecentCall.args[1]();
|
||||||
|
|
||||||
|
// Should have unsubscribed
|
||||||
|
expect(mockUnsubscribe).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
x
Reference in New Issue
Block a user