Open History to see the last commit
1import { filterComposerPullRequestMatches } from "@t3tools/shared/composerPullRequestMatches";
2import { expect, it } from "@effect/vitest";
3
4it("keeps an older exact PR in the mobile menu ahead of twenty newer substring matches", () => {
5 const exact = {
6 number: 42,
7 projectId: "project",
8 repository: "example/repo",
9 updatedAt: "2025-01-01",
10 };
11 const recent = Array.from({ length: 25 }, (_, index) => ({
12 ...exact,
13 number: 4200 + index,
14 updatedAt: "2026-01-01",
15 }));
16 const matches = filterComposerPullRequestMatches({
17 entries: [exact, ...recent, exact],
18 projectId: exact.projectId,
19 repository: exact.repository,
20 query: "42",
21 limit: 20,
22 });
23 expect(matches).toHaveLength(20);
24 expect(matches[0]).toEqual(exact);
25 expect(matches.filter((entry) => entry.number === 42)).toHaveLength(1);
26});