How to use the @commercetools-frontend/browser-history.createEnhancedHistory function in @commercetools-frontend/browser-history

To help you get started, we’ve selected a few @commercetools-frontend/browser-history examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / merchant-center-application-kit / packages / application-shell / src / test-utils / test-utils.js View on Github external
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,
github commercetools / merchant-center-application-kit / packages / application-shell / src / components / application-shell / application-shell.spec.js View on Github external
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>} /&gt;
  );
  return { ...rendered, history: testHistory };
};

@commercetools-frontend/browser-history

Enhances browser history

MIT
Latest version published 3 days ago

Package Health Score

87 / 100
Full package analysis