How to use the @flopflip/memory-adapter.reset function in @flopflip/memory-adapter

To help you get started, we’ve selected a few @flopflip/memory-adapter 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
import {
  NotificationsList,
  NotificationProviderForCustomComponent,
} from '@commercetools-frontend/react-notifications';
import { DOMAINS } from '@commercetools-frontend/constants';
// eslint-disable-next-line import/named
import { createTestMiddleware as createSdkTestMiddleware } from '@commercetools-frontend/sdk/test-utils';
import { GtmContext } from '../components/gtm-booter';
import { createReduxStore } from '../configure-store';
import { createApolloClient } from '../configure-apollo';

// Reset memoryAdapter after each test, so that the next test accepts the
// defaultFlags param.
// This could also be moved into setup-test-framework, not sure which
// location is better for it.
afterEach(memoryAdapter.reset);

// These default values get merged with the values provided by the test from
// the call to "render"

const defaultProject = {
  key: 'test-with-big-data',
  version: 43,
  name: 'Test with big data',
  countries: ['de', 'en'],
  currencies: ['EUR', 'GBP'],
  languages: ['de', 'en-GB', 'en'],
  owner: {
    id: 'project-id-1',
  },
  initialized: true,
  expiry: {
github commercetools / merchant-center-application-kit / src / test-utils.js View on Github external
import React from 'react';
import { Router } from 'react-router-dom';
import { render as rtlRender } from 'react-testing-library';
import { createMemoryHistory } from 'history';
import { IntlProvider } from 'react-intl';
import { ConfigureFlopFlip } from '@flopflip/react-broadcast';
import { MockedProvider as ApolloMockProvider } from 'react-apollo/test-utils';
import memoryAdapter from '@flopflip/memory-adapter';
import { Provider as StoreProvider } from 'react-redux';
import { createReduxStore } from './configure-store';

// Reset memoryAdapter after each test, so that the next test accepts the
// defaultFlags param.
// This could also be moved into setup-test-framework, not sure which
// location is better for it.
afterEach(memoryAdapter.reset);

// This function renders any component within the application context.
// The context is not completely set up yet, some things are missing:
//   - Tracking on context
//   - Project information
//   - possibly more that I'm not aware of right now
//
//  We can add these things as we go and when we need them.

// Inspired by
// https://github.com/kentcdodds/react-testing-library-course/blob/2a5b1560656790bb1d9c055fba3845780b2c2c97/src/__tests__/react-router-03.js
// eslint-disable-next-line import/prefer-default-export
export const render = (
  ui,
  {
    // react-intl

@flopflip/memory-adapter

An in memory adapter for flipflop

MIT
Latest version published 5 months ago

Package Health Score

77 / 100
Full package analysis

Popular @flopflip/memory-adapter functions