How to use @shopify/jest-dom-mocks - 1 common examples

To help you get started, we’ve selected a few @shopify/jest-dom-mocks 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 Shopify / quilt / packages / address-mocks / src / index.ts View on Github external
['countries', 'country'].map(operationName => {
      fetch.mock(
        (url: string, options: Options) => {
          if (url !== GRAPHQL_ENDPOINT || options.method !== 'POST') {
            return false;
          }
          if (typeof options.body === 'string') {
            const body = JSON.parse(options.body);
            return (
              body.operationName === operationName &&
              body.variables.locale === locale
            );
          }
          return false;
        },
        fixtures[operationName][locale],
        {overwriteRoutes: false},
      );

@shopify/jest-dom-mocks

Jest mocking utilities for working with the DOM

MIT
Latest version published 3 days ago

Package Health Score

93 / 100
Full package analysis

Popular @shopify/jest-dom-mocks functions