mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 04:14:09 +00:00
[Plot] Add test for resource release
Add test to detect plot failing to release its subscriptions, which causes WTD-840.
This commit is contained in:
parent
4ac25ab093
commit
63345bbd3b
@ -173,6 +173,19 @@ define(
|
|||||||
// Placeholder; need to support requesting telemetry
|
// Placeholder; need to support requesting telemetry
|
||||||
expect(controller.isRequestPending()).toBeFalsy();
|
expect(controller.isRequestPending()).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("unsubscribes when destroyed", function () {
|
||||||
|
// Make an object available
|
||||||
|
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||||
|
// Make sure $destroy is what's listened for
|
||||||
|
expect(mockScope.$on.mostRecentCall.args[0]).toEqual('$destroy');
|
||||||
|
// Also verify precondition
|
||||||
|
expect(mockSubscription.unsubscribe).not.toHaveBeenCalled();
|
||||||
|
// Destroy the scope
|
||||||
|
mockScope.$on.mostRecentCall.args[1]();
|
||||||
|
// Should have unsubscribed
|
||||||
|
expect(mockSubscription.unsubscribe).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
Reference in New Issue
Block a user