All files / apps/developer-portal/layers/benchmarks/app/components BenchmarksFacts.vue

100% Statements 7/7
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

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  3x                           3x   3x   3x   9x              
<template>
    <PageFacts :provenance="$t('benchmarksFacts.provenance')" :facts />
</template>
 
<script setup lang="ts">
import { BENCHMARK_VERDICTS, countByVerdict } from "#layers/benchmarks/app/utils/benchmarks.ts";
import type { Benchmark } from "#layers/benchmarks/app/types/Benchmark.ts";
import type { PageFact } from "~/types/PageFact";
 
interface Props {
    benchmarks: Benchmark[];
}
 
const { benchmarks } = defineProps<Props>();
 
const { t } = useI18n();
 
const counts = computed(() => countByVerdict(benchmarks));
 
const facts = computed((): PageFact[] => [
    { label: t("benchmarksFacts.sites"), value: String(benchmarks.length) },
    ...BENCHMARK_VERDICTS.map((verdict) => ({
        label: t(`benchmarks.verdict.${verdict}`),
        value: String(counts.value[verdict]),
        class: counts.value[verdict] ? toneClass(benchmarkVerdictTone(verdict)) : "",
    })),
]);
</script>