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

100% Statements 4/4
100% Branches 0/0
100% Functions 3/3
100% Lines 4/4

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              2x 7x     7x               14x    
import {
    BENCHMARKS_PATH,
    sortBenchmarks,
    toBenchmarks,
} from "#layers/benchmarks/app/utils/benchmarks.ts";
 
/** Read straight from the content collection: the frontmatter is the whole record, and nothing collects it. */
export const useBenchmarks = () =>
    useAsyncData(
        "benchmarks",
        async () =>
            sortBenchmarks(
                toBenchmarks(
                    await queryCollection("docs")
                        .where("path", "LIKE", `${BENCHMARKS_PATH}%`)
                        .select("path", "title", "description", "url", "kind", "verdict")
                        .all(),
                ),
            ),
        { default: () => [] },
    );