All files / apps/portfolio/app/components MethodChecks.vue

100% Statements 19/19
100% Branches 8/8
100% Functions 5/5
100% Lines 15/15

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  11x 66x         2x     2x 2x 2x   66x                               11x                 11x   11x 66x 64x 62x     11x 66x      
<template>
    <ul class="flex flex-col">
        <li
            v-for="item in checks"
            :key="item.id"
            class="grid gap-2 border-t border-default py-5 sm:grid-cols-4"
        >
            <span class="font-mono text-xs text-muted uppercase">
                {{ $t(`method.prove.checks.${item.id}.area`) }}
            </span>
            <div class="flex flex-col gap-2 sm:col-span-3">
                <span class="font-display text-2xl text-highlighted">{{ item.claim }}</span>
                <span class="text-base">{{ $t(`method.prove.checks.${item.id}.how`) }}</span>
                <ULink :to="item.to" class="self-start text-primary underline underline-offset-4">
                    {{ $t(`method.prove.checks.${item.id}.cta`) }} →
                </ULink>
            </div>
        </li>
    </ul>
</template>
 
<script setup lang="ts">
interface Props {
    /** Spec files across the repo; `null` when nothing was collected. */
    specs: number | null;
    rules: { enabled: number; inHouse: number } | null;
}
 
const { specs, rules } = defineProps<Props>();
 
const CHECKS = [
    { id: "tests", to: "/coverage" },
    { id: "accessibility", to: "/wiki/packages/configs/readme" },
    { id: "lint", to: "/telemetry" },
    { id: "repository", to: "/wiki/infrastructure/scripts/src/invariants/readme" },
    { id: "design", to: "/graph" },
    { id: "observability", to: "/wiki/packages/observability/readme" },
] as const;
 
const { t } = useI18n();
 
const claimFor = (id: (typeof CHECKS)[number]["id"]): string => {
    if (id === "tests" && specs) return t("method.prove.checks.tests.claimCount", { count: specs });
    if (id === "lint" && rules) return t("method.prove.checks.lint.claimCount", rules);
    return t(`method.prove.checks.${id}.claim`);
};
 
const checks = computed(() =>
    CHECKS.map((check) => ({ ...check, to: portalUrl(check.to), claim: claimFor(check.id) })),
);
</script>