({
headSha,
prNumber = 42,
repoFullName = repo,
platform = 'github' as const,
platformProjectId,
platformIntegrationId: overrideIntegrationId,
}: {
headSha: string;
prNumber?: number;
repoFullName?: string;
platform?: 'github' | 'gitlab';
platformProjectId?: number;
platformIntegrationId?: string;
})
| 875 | repoFullName: `${REPO}-ledger-user-cancel`, |
| 876 | prNumber: 36, |
| 877 | prUrl: `https://github.com/${REPO}-ledger-user-cancel/pull/36`, |
| 878 | prTitle: 'ledger user cancel settle', |
| 879 | prAuthor: 'octocat', |
| 880 | baseRef: 'main', |
| 881 | headRef: 'feature/ledger-user-cancel-settle', |
| 882 | headSha: 'ledger-user-cancel-settle-head-sha', |
| 883 | platform: 'github', |
| 884 | triggerSource: 'manual', |
| 885 | }); |
| 886 | createdReviewIds.push(reviewId); |
| 887 | |
| 888 | const cancelled = await cancelActiveCodeReviewsForIntegration({ |
| 889 | owner: { type: 'org', id: organizationId }, |
| 890 | platform: 'github', |
| 891 | integrationId: organizationIntegrationId, |
| 892 | }); |
| 893 | |
| 894 | expect(cancelled.map(row => row.id)).toContain(reviewId); |
| 895 | expect(cancelled.find(row => row.id === reviewId)?.triggerSource).toBe('manual'); |
| 896 | |
| 897 | const [ledgerRow] = await db |
| 898 | .select({ status: operation_ledgers.status }) |
| 899 | .from(operation_ledgers) |
| 900 | .where(eq(operation_ledgers.operation_key, `review:${reviewId}`)); |
| 901 | expect(ledgerRow?.status).toBe('no_op'); |
| 902 | }); |
| 903 | |
| 904 | it('admits a code_review ledger row with the mapped intent on create', async () => { |
| 905 | const reviewId = await createCodeReview({ |
| 906 | owner: { type: 'user', id: firstUser.id, userId: firstUser.id }, |
| 907 | platformIntegrationId: firstIntegrationId, |
| 908 | repoFullName: `${REPO}-ledger-admit`, |
| 909 | prNumber: 34, |
| 910 | prUrl: `https://github.com/${REPO}-ledger-admit/pull/34`, |
| 911 | prTitle: 'ledger admit', |
| 912 | prAuthor: 'octocat', |
| 913 | baseRef: 'main', |
| 914 | headRef: 'feature/ledger-admit', |
| 915 | headSha: 'ledger-admit-head-sha', |
| 916 | platform: 'github', |
| 917 | triggerSource: 'webhook', |
| 918 | }); |
no test coverage detected