All files / owid-grapher/grapher/dataTable DataTable.sample.ts

100% Statements 61/61
100% Branches 2/2
100% Functions 2/2
100% Lines 61/61

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 761x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                              
import { DimensionProperty } from "../../clientUtils/owidTypes"
import { Grapher } from "../core/Grapher"
import { GrapherTabOption } from "../core/GrapherConstants"
import { GrapherInterface } from "../core/GrapherInterface"
 
export const childMortalityGrapher = (
    props: Partial<GrapherInterface> = {}
): Grapher =>
    new Grapher({
        hasMapTab: true,
        tab: GrapherTabOption.map,
        dimensions: [
            {
                variableId: 104402,
                property: DimensionProperty.y,
            },
        ],
        ...props,
        owidDataset: {
            variables: {
                "104402": {
                    years: [1950, 1950, 2005, 2005, 2019, 2019],
                    entities: [15, 207, 15, 207, 15, 207],
                    values: [224.45, 333.68, 295.59, 246.12, 215.59, 226.12],
                    id: 104402,
                    display: {
                        name: "Child mortality",
                        unit: "%",
                        shortUnit: "%",
                        conversionFactor: 0.1,
                    },
                },
            },
            entityKey: {
                "15": { name: "Afghanistan", id: 15, code: "AFG" },
                "207": { name: "Iceland", id: 207, code: "ICE" },
            },
        },
    })
 
export const IncompleteDataTable = (
    props: Partial<GrapherInterface> = {}
): Grapher =>
    new Grapher({
        tab: GrapherTabOption.table,
        dimensions: [
            {
                variableId: 3512,
                property: DimensionProperty.y,
                display: {
                    name: "",
                    unit: "% of children under 5",
                    tolerance: 1,
                    isProjection: false,
                },
            },
        ],
        ...props,
        owidDataset: {
            variables: {
                "3512": {
                    years: [2000, 2001, 2010, 2010],
                    entities: [207, 33, 15, 207],
                    values: [4, 22, 20, 34],
                    id: 3512,
                    shortUnit: "%",
                },
            },
            entityKey: {
                "15": { name: "Afghanistan", id: 15, code: "AFG" },
                "207": { name: "Iceland", id: 207, code: "ISL" },
                "33": { name: "France", id: 33, code: "FRA" },
            },
        },
    })