All files / apps/developer-portal/layers/audits/app/components AuditsFacts.vue

100% Statements 9/9
100% Branches 2/2
100% Functions 4/4
100% Lines 7/7

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  1x                           1x   1x   1x 1x     1x   3x              
<template>
    <PageFacts :provenance :facts />
</template>
 
<script setup lang="ts">
import { countAll, type AuditReport } from "#layers/audits/shared/auditReports.ts";
import { FINDING_STATUSES } from "#layers/snapshot/shared/audits.ts";
import type { PageFact } from "~/types/PageFact";
 
interface Props {
    reports: AuditReport[];
}
 
const { reports } = defineProps<Props>();
 
const { t } = useI18n();
 
const totals = computed(() => countAll(reports));
 
const provenance = computed(() =>
    t("auditsFacts.provenance", { closed: totals.value.states.closed, total: reports.length }),
);
 
const facts = computed((): PageFact[] => [
    { label: t("auditsFacts.audits"), value: String(reports.length) },
    ...FINDING_STATUSES.map((status) => ({
        label: t(`audits.findingStatus.${status}`),
        value: String(totals.value.findings[status]),
        class: totals.value.findings[status] ? toneClass(findingStatusTone(status)) : "",
    })),
]);
</script>