Wire up logger

Summary:
Splitting this up into the wiring and the actual usage.
This just ensures we have a logger in place for handling
deeplinks.

Reviewed By: mweststrate

Differential Revision: D31337457

fbshipit-source-id: b088a7396e38554a87502ba7d5669dbef1b398d7
This commit is contained in:
Pascal Hartig
2021-10-01 08:07:17 -07:00
committed by Facebook GitHub Bot
parent 4aa7439fbf
commit 7dd9cce9f2
5 changed files with 22 additions and 13 deletions

View File

@@ -20,6 +20,7 @@ import {
useValue,
} from 'flipper-plugin';
import {handleDeeplink} from '../deeplink';
import {Logger} from '../fb-interfaces/Logger';
test('Triggering a deeplink will work', async () => {
const linksSeen: any[] = [];
@@ -46,7 +47,7 @@ test('Triggering a deeplink will work', async () => {
},
},
);
const {renderer, client, store} = await renderMockFlipperWithPlugin(
const {renderer, client, store, logger} = await renderMockFlipperWithPlugin(
definition,
);
@@ -54,6 +55,7 @@ test('Triggering a deeplink will work', async () => {
await handleDeeplink(
store,
logger,
`flipper://${client.query.app}/${definition.id}/universe`,
);
@@ -88,8 +90,11 @@ test('Triggering a deeplink will work', async () => {
});
test('Will throw error on invalid deeplinks', async () => {
// flipper:///support-form/?form=litho
const logger: Logger = {
track: jest.fn(),
} as any;
expect(() =>
handleDeeplink(undefined as any, `flipper://test`),
handleDeeplink(undefined as any, logger, `flipper://test`),
).rejects.toThrowErrorMatchingInlineSnapshot(`"Unknown deeplink"`);
});