How to use the @times-components/fixture-generator.mockEditionSlice function in @times-components/fixture-generator

To help you get started, we’ve selected a few @times-components/fixture-generator 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 / edition-slices / __tests__ / utils.base.js View on Github external
import { mockEditionSlice } from "@times-components/fixture-generator";
import {
  getTileImage,
  getTileSummary,
  getTileStrapline
} from "../src/tiles/shared";

const tile = mockEditionSlice(1).items[0];

jest.mock("@times-components/image", () => "TimesImage");

export default () => {
  describe("getTileImage should", () => {
    test("getTileImage - return null if there is no lead asset", () => {
      const tileWithoutLeadAsset = {
        ...tile,
        article: {
          ...tile.article,
          leadAsset: null,
          listingAsset: null
        },
        leadAsset: null
      };
      expect(getTileImage(tileWithoutLeadAsset, "crop169")).toEqual(null);
github newsuk / times-components / packages / edition-slices / __tests__ / shared-components.base.js View on Github external
import { iterator } from "@times-components/test-utils";
import { mockEditionSlice } from "@times-components/fixture-generator";
import StarButton from "@times-components/star-button";
import { ResponsiveContext } from "@times-components/responsive";
import { editionBreakpoints } from "@times-components/styleguide";
import { TileH, TileX } from "../src/tiles";
import { TileLink, TileStar, TileSummary } from "../src/tiles/shared";
import { ResponsiveSlice } from "../src/slices/shared";

jest.mock("@times-components/article-flag", () => ({
  ArticleFlags: "ArticleFlags"
}));

jest.mock("@times-components/image", () => "TimesImage");

const tile = mockEditionSlice(1).items[0];

export default () => {
  const tests = [
    {
      name:
        "Tile summary falls back to article strapline if strapline is unavailable",
      test: () => {
        const tileWithoutStrapline = {
          ...tile,
          article: {
            ...tile.article,
            strapline: "This is strapline"
          },
          strapline: ""
        };
github newsuk / times-components / packages / provider-test-tools / src / edition.js View on Github external
LeadOneFullWidthSlice: () => ({
            __typename: "LeadOneFullWidthSlice",
            items: mockEditionSlice(1)
          }),
          Markup: (parent, { maxCharCount }) => {
github newsuk / times-components / packages / edition-slices / __tests__ / shared-tiles.base.js View on Github external
TileAN,
  TileAR,
  TileAS,
  TileZ,
  TileAF
} from "../src/tiles";

jest.mock("@times-components/article-flag", () => ({
  ArticleFlags: "ArticleFlags"
}));
jest.mock("@times-components/image", () => "Image");
jest.mock("@times-components/link", () => "Link");
jest.mock("@times-components/gradient", () => "Gradient");
jest.mock("@times-components/article-label", () => "ArticleLabel");

const tile = mockEditionSlice(1).items[0];
const dailyRegisterItem = mockDailyRegisterSlice().birthdaysToday;

const testTile = (Tile, mockTile = tile) => {
  const output = TestRenderer.create(
     {}} tile={mockTile} />
  );
  expect(output).toMatchSnapshot();
};

const testPuzzleTile = Tile => {
  const puzzle = mockPuzzleSlice();
  const output = TestRenderer.create(
     {}}
github newsuk / times-components / packages / provider-test-tools / src / edition.js View on Github external
StandardSection: () => ({
            colour: {
              rgba: {
                alpha: 1,
                blue: 255,
                green: 255,
                red: 255
              }
            },
            id: "dummy-section-id",
            slices: [mockEditionSlice(1)],
            slug: "dummy-section-slug",
            title: "News"
          }),
          StandardSectionSlice: () => ({
github newsuk / times-components / packages / edition-slices / edition-tiles.showcase.js View on Github external
TileX,
  TileY,
  TileZ,
  TileAA,
  TileAB,
  TileAH,
  TileAI,
  TileAL,
  TileAM,
  TileAN,
  TileAR,
  TileAS,
  TileAF
} from "./src/tiles";

const tile = mockEditionSlice(1).items[0];
const dailyRegisterItem = mockDailyRegisterSlice().birthdaysToday;

const preventDefaultedAction = decorateAction =>
  decorateAction([
    ([e, ...args]) => {
      e.preventDefault();
      return ["[SyntheticEvent (storybook prevented default)]", ...args];
    }
  ]);

const renderTile = (Tile, mockTile = tile) => (_, { decorateAction }) => (