From 66ecb88fcb69b1eb193ee7dfbc30581d2f84d8a4 Mon Sep 17 00:00:00 2001 From: Daniel Bachler Date: Wed, 25 Oct 2023 12:45:38 +0200 Subject: [PATCH] :honeybee: remove obsolete test --- datapage/Datapage.test.ts | 76 --------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 datapage/Datapage.test.ts diff --git a/datapage/Datapage.test.ts b/datapage/Datapage.test.ts deleted file mode 100644 index 5cf63f5a038..00000000000 --- a/datapage/Datapage.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -#! /usr/bin/env jest - -import { - EnrichedBlockHeading, - EnrichedBlockText, - OwidGdocInterface, - OwidGdocPublicationContext, -} from "@ourworldindata/utils" -import { parseGdocContentFromAllowedLevelOneHeadings } from "./Datapage.js" - -it("parsed a datapage gdoc into allowed keyed sections", () => { - const getHeadingBlock = (text: string): EnrichedBlockHeading => { - return { - text: [ - { - text, - spanType: "span-simple-text", - }, - ], - type: "heading", - level: 1, - parseErrors: [], - } - } - - const getTextBlock = (text: string): EnrichedBlockText => ({ - type: "text", - value: [ - { - text, - spanType: "span-simple-text", - }, - ], - parseErrors: [], - }) - - const gdoc: OwidGdocInterface = { - id: "id", - slug: "slug", - published: true, - createdAt: new Date(), - publishedAt: new Date(), - updatedAt: new Date(), - publicationContext: OwidGdocPublicationContext.listed, - revisionId: "revisionId", - content: { - authors: ["Our World in Data team"], - body: [ - getHeadingBlock("title"), - getTextBlock("Gini coefficient"), - getHeadingBlock("faqs"), - getTextBlock("Some FAQ content"), - getHeadingBlock("keyInfoText"), - getTextBlock( - "The Gini coefficient is a measure of inequality that ranges between 0 and 1, where higher values indicate higher inequality." - ), - getTextBlock( - "Depending on the country and year, the data relates to either disposable income or consumption per capita, depending on the country and year." - ), - getHeadingBlock("descriptionFromSource"), - getTextBlock("The description from source content"), - getHeadingBlock("sourceDescription1"), - getTextBlock("Beginning of source description"), - getTextBlock("End of source description"), - ], - }, - } - const keyedContentBlocks = parseGdocContentFromAllowedLevelOneHeadings(gdoc) - expect(keyedContentBlocks).toEqual({ - // title is ignored because it's not in AllowedDataPageGdocFields - faqs: gdoc.content.body!.slice(3, 4), - keyInfoText: gdoc.content.body!.slice(5, 7), - descriptionFromSource: gdoc.content.body!.slice(8, 9), - sourceDescription1: gdoc.content.body!.slice(10, 12), - }) -})