All files / apps/developer-portal/layers/benchmarks/app/composables useBenchmarkList.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 2/2
100% Lines 9/9

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        1x 3x 3x   3x 3x 3x   3x 2x             3x    
import { filterBenchmarks } from "#layers/benchmarks/app/utils/benchmarks.ts";
import type { BenchmarkVerdict } from "#layers/benchmarks/app/types/BenchmarkVerdict.ts";
 
/** Every benchmark and the filtered slice the gallery shows; `ready` settles once they load. */
export const useBenchmarkList = () => {
    const read = useBenchmarks();
    const benchmarks = read.data;
 
    const verdict = ref<BenchmarkVerdict | "all">("all");
    const kind = ref("all");
    const search = ref("");
 
    const visible = computed(() =>
        filterBenchmarks(benchmarks.value, {
            verdict: verdict.value,
            kind: kind.value,
            search: search.value,
        }),
    );
 
    return { benchmarks, verdict, kind, search, visible, ready: read };
};