Skip to content

Commit

Permalink
chore: debug tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jul 17, 2024
1 parent 1137e12 commit a5f244b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { envSchema, envValidator, PluginInputs, pluginSettingsSchema, pluginSett
export async function run() {
const payload = github.context.payload.inputs;

console.log("1.");
payload.env = { ...(payload.env || {}), workflowName: github.context.workflow };
if (!envValidator.test(payload.env)) {
const errors: string[] = [];
Expand Down Expand Up @@ -40,15 +41,18 @@ export async function run() {
authToken: payload.authToken,
ref: payload.ref,
};
console.log("2.");

await plugin(inputs, env);
console.log("3.");

return returnDataToKernel(process.env.GITHUB_TOKEN, inputs.stateId, {});
}

export async function returnDataToKernel(repoToken: string, stateId: string, output: object) {
console.log("4.");
const octokit = new Octokit({ auth: repoToken });
return octokit.repos.createDispatchEvent({
return await octokit.repos.createDispatchEvent({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
event_type: "return_data_to_ubiquibot_kernel",
Expand Down
6 changes: 1 addition & 5 deletions tests/configuration.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { afterAll, afterEach, beforeAll, describe, expect, it, jest } from "@jest/globals";
import { HttpResponse } from "msw";
import { server } from "./__mocks__/node";

beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());

jest.mock("../src/action", () => ({
...(jest.requireActual("../src/action") as object),
returnDataToKernel: jest.fn(() => Promise.resolve(new HttpResponse())),
}));
jest.mock("@octokit/rest", () => ({}));

describe("Configuration tests", () => {
it("Should deny the configuration if the required reviewers are less than 1", async () => {
Expand Down

0 comments on commit a5f244b

Please sign in to comment.