Skip to content

Commit fc368fe

Browse files
only21milcodex
andcommitted
test(web): cover Updated pull request display order
Co-Authored-By: GPT-6.1 Sol <[email protected]>
1 parent 6491117 commit fc368fe

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎apps/web/src/components/pullRequest/pullRequestList.logic.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import {
4040
writePullRequestListPreferences,
4141
} from "./pullRequestListPreferences";
4242

43+
import { pullRequestGroups } from "./pullRequestListGroups.logic";
44+
4345
const VIEWERS = { "github.com": "Bilal" } as const;
4446

4547
function entry(
@@ -490,6 +492,36 @@ describe("merging the environments' own listings", () => {
490492
.toEqual([3, 2, 1]);
491493
});
492494

495+
it("orders host timestamps by instant in the Updated view with no search", () => {
496+
const known = [
497+
entry({ number: 1, updatedAt: "2026-07-05T01:00:00+02:00" }),
498+
entry({ number: 2, updatedAt: "2026-07-05T00:30:00Z" }),
499+
entry({ number: 3, updatedAt: "2026-07-05T00:30:00.5Z" }),
500+
];
501+
for (const involvement of ["all", "authored", "reviewing"] as const) {
502+
const { groups } = pullRequestGroups({
503+
known: known.map((row) => ({ ...row, viewerReviewRequested: true })),
504+
providers: [],
505+
viewers: { "github.com": "octocat" },
506+
involvement,
507+
localFilters: {},
508+
hasLocalFilters: false,
509+
text: "",
510+
answeredLocally: true,
511+
baselineEmpty: false,
512+
held: undefined,
513+
authored: [],
514+
reviewing: [],
515+
partitionsWanted: true,
516+
});
517+
expect
518+
.soft(sortPullRequestGroups(groups, "updated", "").flatMap((group) =>
519+
group.entries.map((row) => row.number),
520+
))
521+
.toEqual([3, 2, 1]);
522+
}
523+
});
524+
493525
it("tags every row with the environment that read it, newest first", () => {
494526
const merged = mergePullRequestLists([
495527
[ENV_1, answer({ entries: [entry({ number: 1, updatedAt: "2026-07-01T00:00:00Z" })] })],

0 commit comments

Comments
 (0)