| ... | ... | @@ -27,7 +27,7 @@ import * as Option from "effect/Option"; |
| 27 | 27 | import * as Queue from "effect/Queue"; |
| 28 | 28 | import * as Stream from "effect/Stream"; |
| 29 | 29 | import { TestClock } from "effect/testing"; |
| 30 | | import { describe, expect, it } from "vite-plus/test"; |
| 30 | import { describe, expect, it, vi } from "vite-plus/test"; |
| 31 | 31 | |
| 32 | 32 | import { PersistenceSqlError } from "../../persistence/Errors.ts"; |
| 33 | 33 | import { OrchestrationCommandReceiptRepositoryLive } from "../../persistence/Layers/OrchestrationCommandReceipts.ts"; |
| ... | ... | @@ -1039,6 +1039,8 @@ describe("OrchestrationEngine", () => { |
| 1039 | 1039 | }, |
| 1040 | 1040 | }), |
| 1041 | 1041 | }); |
| 1042 | // Same-tick links must replace the old PR, not rely on timestamp ordering. |
| 1043 | const clock = vi.spyOn(Date, "now").mockReturnValue(Date.parse(now())); |
| 1042 | 1044 | try { |
| 1043 | 1045 | const projectId = ProjectId.make("pr-race-project"); |
| 1044 | 1046 | const threadId = ThreadId.make("pr-race-thread"); |
| ... | ... | @@ -1141,6 +1143,9 @@ describe("OrchestrationEngine", () => { |
| 1141 | 1143 | if (change === "delete") return; |
| 1142 | 1144 | const current = (await system.readModel()).threads[0]; |
| 1143 | 1145 | expect(current?.branchPullRequest ?? null).toBeNull(); |
| 1146 | expect(current?.pullRequests.map((link) => link.number)).toEqual( |
| 1147 | change === "unlink" ? [] : change === "relink" ? [3] : [1], |
| 1148 | ); |
| 1144 | 1149 | expect(current?.linkedPullRequest ?? null).toEqual( |
| 1145 | 1150 | change === "unlink" |
| 1146 | 1151 | ? null |
| ... | ... | @@ -1149,6 +1154,7 @@ describe("OrchestrationEngine", () => { |
| 1149 | 1154 | : previous, |
| 1150 | 1155 | ); |
| 1151 | 1156 | } finally { |
| 1157 | clock.mockRestore(); |
| 1152 | 1158 | await system.dispose(); |
| 1153 | 1159 | } |
| 1154 | 1160 | }, |