src/app/components/Embeds/EmbedImages/fixtures.ts

Summary

Maintainability
C
1 day
Test Coverage
A
100%
const chartEmbedImages = {
  blocks: [
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'CPS vs Optimo usage. .  .',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'CPS vs Optimo usage. .  .',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 852,
              width: 920,
              locator: '/idt2/793f648b-b17f-489a-a473-9e5a71f12684/image/460',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'CPS vs Optimo usage. .  .',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'CPS vs Optimo usage. .  .',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 1054,
              width: 1280,
              locator: '/idt2/793f648b-b17f-489a-a473-9e5a71f12684/image/640',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'CPS vs Optimo usage. .  .',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'CPS vs Optimo usage. .  .',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 1252,
              width: 1632,
              locator: '/idt2/793f648b-b17f-489a-a473-9e5a71f12684/image/816',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
  ],
};

const mapEmbedImages = {
  blocks: [
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'Map: 2020 Olympic Countries beginning with A',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'Map: 2020 Olympic Countries beginning with A',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 920,
              width: 920,
              locator: '/idt2/357fce55-4885-4dd6-ade7-cb35188cccb9/image/460',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'Map: 2020 Olympic Countries beginning with A',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'Map: 2020 Olympic Countries beginning with A',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 720,
              width: 1280,
              locator: '/idt2/357fce55-4885-4dd6-ade7-cb35188cccb9/image/640',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'Map: 2020 Olympic Countries beginning with A',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'Map: 2020 Olympic Countries beginning with A',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 918,
              width: 1632,
              locator: '/idt2/357fce55-4885-4dd6-ade7-cb35188cccb9/image/816',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
  ],
};

const tableEmbedImages = {
  blocks: [
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'Fake Temperatures. .  .',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'Fake Temperatures. .  .',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 666,
              width: 920,
              locator: '/idt2/d54a6d54-a1aa-41af-8eff-43e0c9c0f440/image/460',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'Fake Temperatures. .  .',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'Fake Temperatures. .  .',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 626,
              width: 1280,
              locator: '/idt2/d54a6d54-a1aa-41af-8eff-43e0c9c0f440/image/640',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
    {
      type: 'image',
      model: {
        blocks: [
          {
            type: 'altText',
            model: {
              blocks: [
                {
                  type: 'text',
                  model: {
                    blocks: [
                      {
                        type: 'paragraph',
                        model: {
                          text: 'Fake Temperatures. .  .',
                          blocks: [
                            {
                              type: 'fragment',
                              model: {
                                text: 'Fake Temperatures. .  .',
                                attributes: [],
                              },
                            },
                          ],
                        },
                      },
                    ],
                  },
                },
              ],
            },
          },
          {
            type: 'rawImage',
            model: {
              height: 626,
              width: 1632,
              locator: '/idt2/d54a6d54-a1aa-41af-8eff-43e0c9c0f440/image/816',
              href: null,
              originCode: 'idt2',
              copyrightHolder: 'bbc',
              suitableForSyndication: true,
            },
          },
        ],
      },
    },
  ],
};

interface types {
  locator?: string | null | undefined;
  alt?: string | null | undefined;
  width?: number | null | undefined;
  height?: number | null | undefined;
}

const createEmbedImagesFixture = ({
  locator = '/idt2/d54a6d54-a1aa-41af-8eff-43e0c9c0f440/image/816',
  alt = 'CPS vs Optimo usage. .  .',
  width = 1632,
  height = 1252,
}: types) => {
  return {
    blocks: [
      {
        type: 'image',
        model: {
          blocks: [
            {
              type: 'altText',
              model: {
                blocks: [
                  {
                    type: 'text',
                    model: {
                      blocks: [
                        {
                          type: 'paragraph',
                          model: {
                            text: 'CPS vs Optimo usage. .  .',
                            blocks: [
                              {
                                type: 'fragment',
                                model: {
                                  text: 'CPS vs Optimo usage. .  .',
                                  attributes: [],
                                },
                              },
                            ],
                          },
                        },
                      ],
                    },
                  },
                ],
              },
            },
            {
              type: 'rawImage',
              model: {
                height: 852,
                width: 920,
                locator: '/idt2/793f648b-b17f-489a-a473-9e5a71f12684/image/460',
                href: null,
                originCode: 'idt2',
                copyrightHolder: 'bbc',
                suitableForSyndication: true,
              },
            },
          ],
        },
      },
      {
        type: 'image',
        model: {
          blocks: [
            {
              type: 'altText',
              model: {
                blocks: [
                  {
                    type: 'text',
                    model: {
                      blocks: [
                        {
                          type: 'paragraph',
                          model: {
                            text: 'CPS vs Optimo usage. .  .',
                            blocks: [
                              {
                                type: 'fragment',
                                model: {
                                  text: 'CPS vs Optimo usage. .  .',
                                  attributes: [],
                                },
                              },
                            ],
                          },
                        },
                      ],
                    },
                  },
                ],
              },
            },
            {
              type: 'rawImage',
              model: {
                height: 1054,
                width: 1280,
                locator: '/idt2/793f648b-b17f-489a-a473-9e5a71f12684/image/640',
                href: null,
                originCode: 'idt2',
                copyrightHolder: 'bbc',
                suitableForSyndication: true,
              },
            },
          ],
        },
      },
      {
        type: 'image',
        model: {
          blocks: [
            {
              type: 'altText',
              model: {
                blocks: [
                  {
                    type: 'text',
                    model: {
                      blocks: [
                        {
                          type: 'paragraph',
                          model: {
                            text: alt,
                            blocks: [
                              {
                                type: 'fragment',
                                model: {
                                  text: alt,
                                  attributes: [],
                                },
                              },
                            ],
                          },
                        },
                      ],
                    },
                  },
                ],
              },
            },
            {
              type: 'rawImage',
              model: {
                height,
                width,
                locator,
                href: null,
                originCode: 'idt2',
                copyrightHolder: 'bbc',
                suitableForSyndication: true,
              },
            },
          ],
        },
      },
    ],
  };
};

export {
  chartEmbedImages,
  mapEmbedImages,
  tableEmbedImages,
  createEmbedImagesFixture,
};