Add unit tests for selection changes and plugin list computation

Summary: Tests to verify the more complex selection logic resulting from the Metro device exception. Also verifies the logic that computes the available plugins

Reviewed By: nikoant

Differential Revision: D24445555

fbshipit-source-id: 70110c4470e6aa1356e814aa40744b65c21cad89
This commit is contained in:
Michel Weststrate
2020-10-22 09:37:26 -07:00
committed by Facebook GitHub Bot
parent 99dfeacdf8
commit 4f7294c96d
4 changed files with 310 additions and 8 deletions

View File

@@ -47,7 +47,7 @@ async function isMetroRunning(): Promise<boolean> {
});
}
async function registerDevice(
export async function registerMetroDevice(
ws: WebSocket | undefined,
store: Store,
logger: Logger,
@@ -117,7 +117,7 @@ export default (store: Store, logger: Logger) => {
_ws.onopen = () => {
clearTimeout(guard);
ws = _ws;
registerDevice(ws, store, logger);
registerMetroDevice(ws, store, logger);
};
_ws.onclose = _ws.onerror = () => {
@@ -138,7 +138,7 @@ export default (store: Store, logger: Logger) => {
`Flipper did find a running Metro instance, but couldn't connect to the logs. Probably your React Native version is too old to support Flipper. Cause: Failed to get a connection to ${METRO_LOGS_ENDPOINT} in a timely fashion`,
),
);
registerDevice(undefined, store, logger);
registerMetroDevice(undefined, store, logger);
// Note: no scheduleNext, we won't retry until restart
}, 5000);
} else {