Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const renderApp = (
ui,
{
// react-intl
locale = 'en',
// Apollo
mocks = [],
addTypename = false,
// react-router
route = '/',
history = createEnhancedHistory(
createMemoryHistory({ initialEntries: [route] })
),
// flopflip
adapter = memoryAdapter,
flags = {},
// application-context
environment,
user,
project,
permissions, // <-- deprecated option, use `{ project: { allAppliedPermissions } }`
actionRights, // <-- deprecated option, use `{ project: { allAppliedActionRights } }`
dataFences, // <-- deprecated option, use `{ project: { allAppliedDataFences } }`
dataLocale = 'en',
ApolloProviderComponent = MockedApolloProvider,
// gtm-context
gtmTracking = defaultGtmTracking,
const renderApp = (ui, options = {}) => {
const initialRoute = options.route || '/';
const testHistory = createEnhancedHistory(
createMemoryHistory({ initialEntries: [initialRoute] })
);
ApplicationShellProvider.history = testHistory;
const testApolloClient = createApolloClient();
ApplicationShellProvider.apolloClient = testApolloClient;
const defaultProps = createTestProps();
const props = {
...defaultProps,
environment: { ...defaultProps.environment, ...options.environment },
};
const rendered = render(
ui || <p>{'OK'}</p>} />
);
return { ...rendered, history: testHistory };
};