Make sure Sandy Device Plugins can be unit testsed

Summary: Add unit tests to verify that the unit test utilities for for Sandy device plugins work as expected. Fixed a bug revealed by that and cleaned up some TODO's

Reviewed By: jknoxville, passy, nikoant

Differential Revision: D22693928

fbshipit-source-id: 93162db19d826d0cd7f642cef1447fd756261ac8
This commit is contained in:
Michel Weststrate
2020-08-04 07:05:57 -07:00
committed by Facebook GitHub Bot
parent 91ed4e31c0
commit 1e956e1bf5
5 changed files with 249 additions and 24 deletions

View File

@@ -137,28 +137,9 @@ export class SandyDevicePluginInstance {
this.activated = true;
this.events.emit('activate');
}
// TODO:
// const pluginId = this.definition.id;
// if (!this.realClient.isBackgroundPlugin(pluginId)) {
// this.realClient.initPlugin(pluginId); // will call connect() if needed
// }
}
// the plugin is deselected in the UI
deactivate() {
// TODO:
// if (this.destroyed) {
// // this can happen if the plugin is disabled while active in the UI.
// // In that case deinit & destroy is already triggered from the STAR_PLUGIN action
// return;
// }
// const pluginId = this.definition.id;
// if (!this.realClient.isBackgroundPlugin(pluginId)) {
// this.realClient.deinitPlugin(pluginId);
// }
}
disconnect() {
this.assertNotDestroyed();
if (this.activated) {
this.activated = false;
@@ -168,10 +149,7 @@ export class SandyDevicePluginInstance {
destroy() {
this.assertNotDestroyed();
// TODO:
// if (this.activated) {
// this.realClient.deinitPlugin(this.definition.id);
// }
this.deactivate();
this.events.emit('destroy');
this.destroyed = true;
}