settlekit/packages/github/test/github-access-granter.test.ts
caelum0x 4afda54455 feat: monorepo scaffold + @settlekit/common contract package
- pnpm workspace, shared tsconfig, vitest
- common: ids, money (USDC base-unit math), Result/SettleKitError, time
- domain types: product, customer, payment, entitlement, delivery, integration
- 13 passing contract tests
2026-06-15 02:55:22 +03:00

31 lines
876 B
TypeScript

import { describe, expect, it } from "vitest";
import { grantGitHubRepoAccess, type GitHubAccessClient } from "../src/index.js";
const client: GitHubAccessClient = {
async inviteRepoCollaborator() {
return { invitationId: 123 };
},
async removeRepoCollaborator() {},
async addTeamMembership() {},
async removeTeamMembership() {},
async getRepoCollaboratorPermission() {
return "read";
},
};
describe("grantGitHubRepoAccess", () => {
it("creates an invited access grant", async () => {
const grant = await grantGitHubRepoAccess(client, {
organizationId: "org_1",
installationId: 1,
customerId: "cus_1",
entitlementId: "ent_1",
repoOwner: "seller",
repoName: "private-template",
githubUsername: "buyer",
});
expect(grant.status).toBe("invited");
expect(grant.invitationId).toBe(123);
});
});