40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { test } from "./main.js";
|
|
delete process.env.INPUT_OWNER;
|
|
delete process.env.INPUT_REPOSITORIES;
|
|
|
|
// Verify `main` handles when no enterprise installation is found.
|
|
await test((mockPool) => {
|
|
process.env.INPUT_ENTERPRISE = "test-enterprise";
|
|
|
|
|
|
// Mock the /app/installations endpoint to return only non-enterprise installations
|
|
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: "111111",
|
|
app_slug: "github-actions",
|
|
target_type: "Organization",
|
|
account: { login: "some-org" }
|
|
},
|
|
{
|
|
id: "222222",
|
|
app_slug: "github-actions",
|
|
target_type: "User",
|
|
account: { login: "some-user" }
|
|
}
|
|
],
|
|
{ headers: { "content-type": "application/json" } }
|
|
);
|
|
});
|