How to use the @times-components/jest-serializer.enzymeRenderedSerializer 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 / slice-layout / __tests__ / serializers-with-style.web.js View on Github external
} from "@times-components/jest-serializer";

const styles = [
  "borderBottomColor",
  "borderBottomWidth",
  "borderStyle",
  "paddingBottom",
  "paddingLeft",
  "paddingRight",
  "paddingTop",
  "width"
];

addSerializers(
  expect,
  enzymeRenderedSerializer(),
  compose(
    stylePrinter,
    minimalWebTransform,
    flattenStyleTransform,
    rnwTransform(AppRegistry, styles)
  )
);

// eslint-disable-next-line global-require
require("jest-styled-components");
github newsuk / times-components / packages / related-articles / __tests__ / shared-with-style.web.js View on Github external
"fontFamily",
  "fontSize",
  "fontWeight",
  "height",
  "justifyContent",
  "lineHeight",
  "marginBottom",
  "marginTop"
];

jest.mock("@times-components/card", () => "Card");
jest.mock("@times-components/link", () => "Link");

addSerializers(
  expect,
  enzymeRenderedSerializer(),
  compose(
    stylePrinter,
    minimalWebTransform,
    minimaliseTransform((value, key) => key !== "style" && key !== "className"),
    rnwTransform(AppRegistry, styles),
    hoistStyleTransform
  )
);

// eslint-disable-next-line global-require
require("jest-styled-components");
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);
};
github newsuk / times-components / packages / article / __tests__ / shared.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      print,
      minimalWebTransform,
      minimaliseTransform((value, key) => omitProps.has(key))
    )
  );

  shared(TestRenderer.create);
};
github newsuk / times-components / packages / edition-slices / __tests__ / tile-aa / shared-tile-aa.native.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      print,
      minimalNativeTransform,
      flattenStyleTransform
    )
  );

  shared();
};
github newsuk / times-components / packages / markup / __tests__ / shared.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      stylePrinter,
      flattenStyleTransform,
      hoistStyleTransform,
      minimalWebTransform,
      rnwTransform(AppRegistry)
    )
  );

  shared(mount);
};
github newsuk / times-components / packages / article-paragraph / __tests__ / shared.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      stylePrinter,
      rnwTransform(AppRegistry),
      minimalWebTransform,
      minimaliseTransform(
        (value, key) => key === "style" || key === "className"
      )
    )
  );

  iterator(shared());
};
github newsuk / times-components / packages / video / __tests__ / video-shared.native.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    compose(
      print,
      minimalNativeTransform,
      minimaliseTransform(
        (value, key) =>
          key === "style" ||
          key === "nativeBackgroundAndroid" ||
          key.includes("Class")
      ),
      replacePropTransform((value, key) => {
        if (key === "uri") {
          return hash(value);
        }
        if (key === "source" && value.uri) {
          return hash(value.uri);
        }
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 / article-list / __tests__ / shared-lazy.web.js View on Github external
export default () => {
  addSerializers(
    expect,
    enzymeRenderedSerializer(),
    minimalise((value, key) => omitProps.has(key))
  );

  const realIntl = Intl;

  beforeEach(() => {
    global.Intl = {
      DateTimeFormat: () => ({
        resolvedOptions: () => ({ timeZone: "Europe/London" })
      })
    };
  });

  afterEach(() => {
    global.Intl = realIntl;
    jest.restoreAllMocks();