From a5f244b41106acf040652e3f3974607f801f7d69 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:12:42 +0900 Subject: [PATCH] chore: debug tests --- src/action.ts | 6 +++++- tests/configuration.test.ts | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/action.ts b/src/action.ts index 9d45f86a..55f42daa 100644 --- a/src/action.ts +++ b/src/action.ts @@ -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[] = []; @@ -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", diff --git a/tests/configuration.test.ts b/tests/configuration.test.ts index dbbc2f6f..3c468eaa 100644 --- a/tests/configuration.test.ts +++ b/tests/configuration.test.ts @@ -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 () => {