Fix debug output in unit tests

Summary:
unit tests for deeplinks were logging full device / client objects instances, changed it to log the meta data only (description resp. query).

Since Jest buffers console output, this might even help test stability

Maybe console.debug shouldn't even be printed in Jest? See next diff

Reviewed By: passy

Differential Revision: D32557412

fbshipit-source-id: ff7fbf0cb5d8684d5333a62dac02fd5a59a6e358
This commit is contained in:
Michel Weststrate
2021-11-19 03:59:55 -08:00
committed by Facebook GitHub Bot
parent 35c482ac92
commit 52fca0859e

View File

@@ -103,7 +103,14 @@ export async function handleOpenPluginDeeplink(
title,
isDevicePlugin,
);
console.debug('[deeplink] Selected device and client:', deviceOrClient);
console.debug(
'[deeplink] Selected device and client:',
deviceOrClient instanceof BaseDevice
? deviceOrClient.description
: deviceOrClient instanceof Client
? deviceOrClient.query
: deviceOrClient,
);
if ('errorState' in deviceOrClient) {
trackInteraction({
state: deviceOrClient.errorState,
@@ -117,8 +124,8 @@ export async function handleOpenPluginDeeplink(
const device: BaseDevice = isDevicePlugin
? (deviceOrClient as BaseDevice)
: (deviceOrClient as Client).device;
console.debug('[deeplink] Client: ', client);
console.debug('[deeplink] Device: ', device);
console.debug('[deeplink] Client: ', client?.query);
console.debug('[deeplink] Device: ', device?.description);
// verify plugin supported by selected device / client
if (isDevicePlugin && !device.supportsPlugin(pluginDefinition)) {
@@ -484,7 +491,7 @@ async function selectDevicesAndClient(
const availableDevices = findValidDevices();
console.debug(
'[deeplink] selectDevicesAndClient found at least one more valid device:',
availableDevices,
availableDevices.map((d) => d.description),
);
// device plugin
if (isDevicePlugin) {