How to use the @times-components/jest-serializer.replaceTransform function in @times-components/jest-serializer

To help you get started, we’ve selected a few @times-components/jest-serializer 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 newsuk / times-components / packages / card / __tests__ / web / serializers.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeTreeSerializer(),
    compose(
      stylePrinter,
      replaceTransform({
        CardComponent: justChildren,
        CardContent: justChildren,
        Gradient: propsNoChildren,
        Loading: justChildren,
        TimesImage: propsNoChildren,
        ...meltNative
      }),
      flattenStyleTransform,
      hoistStyleTransform,
      minimalWebTransform,
      rnwTransform(AppRegistry, styles)
    )
  );

  // eslint-disable-next-line global-require
  require("jest-styled-components");
github newsuk / times-components / packages / article-image / __tests__ / shared-with-style.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeTreeSerializer(),
    compose(
      print,
      replaceTransform({
        ArticleImage: justChildren,
        ArticleImageWeb: justChildren,
        Caption: justChildren,
        InlineImage: justChildren,
        InsetCaptionWeb: justChildren,
        "responsive-styles__component": justChildren,
        TimesImage: propsNoChildren,
        ...meltNative
      }),
      minimalWebTransform,
      minimaliseTransform((value, key) => key === "style"),
      rnwTransform(AppRegistry)
    )
  );

  // eslint-disable-next-line global-require
github newsuk / times-components / packages / card / __tests__ / shared.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeTreeSerializer(),
    compose(
      print,
      minimalWebTransform,
      minimaliseTransform(
        (value, key) => key === "style" || key === "className"
      ),
      replaceTransform({
        CardComponent: justChildren,
        CardContent: justChildren,
        Gradient: propsNoChildren,
        Loading: justChildren,
        TimesImage: propsNoChildren,
        ...meltNative
      }),
      rnwTransform(AppRegistry)
    )
  );

  shared(mount);
};
github newsuk / times-components / packages / markup / __tests__ / shared-ad.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeTreeSerializer(),
    compose(
      stylePrinter,
      flattenStyleTransform,
      replaceTransform({
        Ad: propsNoChildren,
        AdComposer: justChildren,
        Broadcast: justChildren,
        ...meltNative
      }),
      rnwTransform()
    )
  );

  shared(component => mount({component}));
};
github newsuk / times-components / packages / icons / __tests__ / shared-colour.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      print,
      replaceTransform({
        svg: justChildren
      }),
      minimaliseTransform((value, key) => key !== "fill" && key !== "stroke"),
      replacePropTransform(
        (value, key) =>
          longKeysSet.has(key) ? hash(JSON.stringify(value)) : value
      )
    )
  );

  shared(mount);
};
github newsuk / times-components / packages / icons / __tests__ / shared-dim.native.js View on Github external
export default () => {
  addSerializers(
    expect,
    compose(
      print,
      replaceTransform({
        ARTSurfaceView: propsNoChildren,
        RNSVGPath: propsNoChildren,
        RNSVGSvgView: propsNoChildren
      }),
      flattenStyleTransform,
      minimaliseTransform((value, key) => key === "opacity")
    )
  );

  shared(TestRenderer.create);
};
github newsuk / times-components / packages / icons / __tests__ / shared-colour.native.js View on Github external
export default () => {
  addSerializers(
    expect,
    compose(
      print,
      replaceTransform({
        ARTGroup: justChildren,
        ARTSurfaceView: justChildren
      }),
      flattenStyleTransform,
      minimaliseTransform((value, key) => key !== "stroke" && key !== "fill")
    )
  );

  shared(TestRenderer.create);
};
github newsuk / times-components / packages / article-image / __tests__ / shared.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      print,
      replaceTransform({
        ArticleImage: justChildren,
        ArticleImageWeb: justChildren,
        Caption: justChildren,
        TimesImage: propsNoChildren,
        ...meltNative
      }),
      minimalWebTransform,
      minimaliseTransform(
        (value, key) => key === "style" || key === "className"
      ),
      rnwTransform(AppRegistry)
    )
  );

  shared(component => mount(component));
};
github newsuk / times-components / packages / icons / __tests__ / shared-dim.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      print,
      replaceTransform({
        svg: propsNoChildren
      }),
      minimaliseTransform((value, key) => key === "style" || key === "viewBox"),
      replacePropTransform(
        (value, key) =>
          longKeysSet.has(key) ? hash(JSON.stringify(value)) : value
      )
    )
  );

  shared(mount);
};