tests; update README
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { test } from "./main.js";
|
||||
|
||||
// Verify `main` successfully obtains a token when only the `enterprise` input is set.
|
||||
await test((mockPool) => {
|
||||
process.env.INPUT_ENTERPRISE = "test-enterprise";
|
||||
delete process.env.INPUT_OWNER;
|
||||
delete process.env.INPUT_REPOSITORIES;
|
||||
|
||||
// Mock the /app/installations endpoint to return an enterprise installation
|
||||
const mockInstallationId = "123456";
|
||||
const mockAppSlug = "github-actions";
|
||||
mockPool
|
||||
.intercept({
|
||||
path: "/app/installations",
|
||||
method: "GET",
|
||||
headers: {
|
||||
accept: "application/vnd.github.v3+json",
|
||||
"user-agent": "actions/create-github-app-token",
|
||||
// Intentionally omitting the `authorization` header, since JWT creation is not idempotent.
|
||||
},
|
||||
})
|
||||
.reply(
|
||||
200,
|
||||
[
|
||||
{
|
||||
id: mockInstallationId,
|
||||
app_slug: mockAppSlug,
|
||||
target_type: "Enterprise",
|
||||
account: { login: "test-enterprise" }
|
||||
}
|
||||
],
|
||||
{ headers: { "content-type": "application/json" } }
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user