Skip to content

Commit 2a6e85e

Browse files
only21milcodex
andcommitted
test(web): cover pull request timestamp ordering
Co-Authored-By: GPT-6.1 Sol <[email protected]>
1 parent 5ffe045 commit 2a6e85e

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,23 @@ describe("review verdicts", () => {
313313
});
314314

315315
describe("pull request timeline", () => {
316+
it("orders host timestamps by instant across offsets and fractional seconds", () => {
317+
const events = buildPullRequestTimeline({
318+
...TIMELINE_SOURCE,
319+
createdAt: "2026-07-05T01:00:00+02:00",
320+
commits: [
321+
{ oid: "commit", messageHeadline: "", committedDate: "2026-07-05T00:30:00Z" },
322+
],
323+
comments: [
324+
{ ...TIMELINE_SOURCE.comments[0]!, createdAt: "2026-07-05T00:30:00.5Z" },
325+
],
326+
mergedAt: null,
327+
closedAt: null,
328+
});
329+
330+
expect(events.map((event) => event.id)).toEqual(["c1", "commit", "created"]);
331+
});
332+
316333
it("drops a body that is nothing but a bot's HTML comment, and keeps one that says more", () => {
317334
const events = buildPullRequestTimeline({
318335
...TIMELINE_SOURCE,

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,28 @@ describe("merging the environments' own listings", () => {
468468
...overrides,
469469
}) as Parameters<typeof mergePullRequestLists>[0][number][1];
470470

471+
it("orders host timestamps by instant across merged feeds and recency rankings", () => {
472+
const entries = [
473+
entry({ number: 1, updatedAt: "2026-07-05T01:00:00+02:00" }),
474+
entry({ number: 2, updatedAt: "2026-07-05T00:30:00Z" }),
475+
entry({ number: 3, updatedAt: "2026-07-05T00:30:00.5Z" }),
476+
];
477+
const merged = mergePullRequestLists([
478+
[ENV_1, answer({ entries: entries.slice(0, 2) })],
479+
[ENV_2, answer({ entries: entries.slice(2) })],
480+
]);
481+
const groups = partitionPullRequestsWithPriority(entries, entries, []);
482+
483+
expect.soft(merged?.entries.map((row) => row.number)).toEqual([3, 2, 1]);
484+
expect.soft(groups[0]?.entries.map((row) => row.number)).toEqual([3, 2, 1]);
485+
expect.soft(rankPullRequestMatches(entries, "pull").map((row) => row.number)).toEqual([
486+
3, 2, 1,
487+
]);
488+
expect.soft(rankPullRequestsByMergeReadiness(entries).map((row) => row.number)).toEqual([
489+
3, 2, 1,
490+
]);
491+
});
492+
471493
it("tags every row with the environment that read it, newest first", () => {
472494
const merged = mergePullRequestLists([
473495
[ENV_1, answer({ entries: [entry({ number: 1, updatedAt: "2026-07-01T00:00:00Z" })] })],

0 commit comments

Comments
 (0)