From e52a87bd91a08ea6a8711714820a340cb5dadc48 Mon Sep 17 00:00:00 2001 From: Jimmy Bosse Date: Fri, 21 Jun 2024 17:01:36 -0400 Subject: [PATCH] - instead of _ --- ..._sample.json => dependabot-pr-sample.json} | 0 ..._client.test.js => fogbogz-client.test.js} | 2 +- __tests__/main.test.js | 8 +++---- ..._a_pr_sample.json => not-a-pr-sample.json} | 0 ...client.test.js => planview-client.test.js} | 2 +- ..._pr_sample.json => regular-pr-sample.json} | 0 ...ync_pr_sample.json => sync-pr-sample.json} | 0 __tests__/wait.test.ignore | 24 ------------------- src/{fogbugz_client.js => fogbugz-client.js} | 0 src/main.js | 6 ++--- ...{planview_client.js => planview-client.js} | 0 11 files changed, 9 insertions(+), 33 deletions(-) rename __tests__/{dependabot_pr_sample.json => dependabot-pr-sample.json} (100%) rename __tests__/{fogbogz_client.test.js => fogbogz-client.test.js} (98%) rename __tests__/{not_a_pr_sample.json => not-a-pr-sample.json} (100%) rename __tests__/{planview_client.test.js => planview-client.test.js} (98%) rename __tests__/{regular_pr_sample.json => regular-pr-sample.json} (100%) rename __tests__/{sync_pr_sample.json => sync-pr-sample.json} (100%) delete mode 100644 __tests__/wait.test.ignore rename src/{fogbugz_client.js => fogbugz-client.js} (100%) rename src/{planview_client.js => planview-client.js} (100%) diff --git a/__tests__/dependabot_pr_sample.json b/__tests__/dependabot-pr-sample.json similarity index 100% rename from __tests__/dependabot_pr_sample.json rename to __tests__/dependabot-pr-sample.json diff --git a/__tests__/fogbogz_client.test.js b/__tests__/fogbogz-client.test.js similarity index 98% rename from __tests__/fogbogz_client.test.js rename to __tests__/fogbogz-client.test.js index 429295b..c0764d6 100644 --- a/__tests__/fogbogz_client.test.js +++ b/__tests__/fogbogz-client.test.js @@ -1,5 +1,5 @@ const axios = require("axios"); -const FogBugzClient = require("../src/fogbugz_client"); +const FogBugzClient = require("../src/fogbugz-client"); const postMock = jest.spyOn(axios, "post").mockImplementation(); diff --git a/__tests__/main.test.js b/__tests__/main.test.js index 2c59dee..02c02d1 100644 --- a/__tests__/main.test.js +++ b/__tests__/main.test.js @@ -4,12 +4,12 @@ const core = require('@actions/core'); const github = require("@actions/github"); -const FogBugzClient = require("../src/fogbugz_client"); -jest.mock("../src/fogbugz_client", () => jest.fn()); +const FogBugzClient = require("../src/fogbugz-client"); +jest.mock("../src/fogbugz-client", () => jest.fn()); const createCase = jest.fn(); -const PlanviewClient = require("../src/planview_client"); -jest.mock("../src/planview_client", () => jest.fn()); +const PlanviewClient = require("../src/planview-client"); +jest.mock("../src/planview-client", () => jest.fn()); const createCard = jest.fn(); const dependabotPr = require("./dependabot_pr_sample.json"); diff --git a/__tests__/not_a_pr_sample.json b/__tests__/not-a-pr-sample.json similarity index 100% rename from __tests__/not_a_pr_sample.json rename to __tests__/not-a-pr-sample.json diff --git a/__tests__/planview_client.test.js b/__tests__/planview-client.test.js similarity index 98% rename from __tests__/planview_client.test.js rename to __tests__/planview-client.test.js index 9cb92a4..8fa20c2 100644 --- a/__tests__/planview_client.test.js +++ b/__tests__/planview-client.test.js @@ -1,5 +1,5 @@ const axios = require("axios"); -const PlanviewClient = require("../src/planview_client"); +const PlanviewClient = require("../src/planview-client"); const postMock = jest.spyOn(axios, "post").mockImplementation(); diff --git a/__tests__/regular_pr_sample.json b/__tests__/regular-pr-sample.json similarity index 100% rename from __tests__/regular_pr_sample.json rename to __tests__/regular-pr-sample.json diff --git a/__tests__/sync_pr_sample.json b/__tests__/sync-pr-sample.json similarity index 100% rename from __tests__/sync_pr_sample.json rename to __tests__/sync-pr-sample.json diff --git a/__tests__/wait.test.ignore b/__tests__/wait.test.ignore deleted file mode 100644 index d58edc5..0000000 --- a/__tests__/wait.test.ignore +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Unit tests for src/wait.js - */ -const { wait } = require('../src/wait') -const { expect } = require('@jest/globals') - -describe('wait.js', () => { - it('throws an invalid number', async () => { - const input = parseInt('foo', 10) - expect(isNaN(input)).toBe(true) - - await expect(wait(input)).rejects.toThrow('milliseconds not a number') - }) - - it('waits with a valid number', async () => { - const start = new Date() - await wait(500) - const end = new Date() - - const delta = Math.abs(end.getTime() - start.getTime()) - - expect(delta).toBeGreaterThan(450) - }) -}) diff --git a/src/fogbugz_client.js b/src/fogbugz-client.js similarity index 100% rename from src/fogbugz_client.js rename to src/fogbugz-client.js diff --git a/src/main.js b/src/main.js index e70d84c..a085440 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,7 @@ const core = require('@actions/core'); const github = require("@actions/github"); -const FogBugzClient = require("./fogbugz_client"); -const planview_client = require("./planview_client"); +const FogBugzClient = require("./fogbugz-client"); +const PlanviewClient = require("./planview-client"); async function run() { core.debug("Running action"); @@ -35,7 +35,7 @@ async function run() { core.debug(`fbt_result: ${JSON.stringify(fbt_result)}`); if (fbt_result.success) { core.setOutput("fogbugz_id", fbt_result.case.ixBug); - const pvc = new planview_client(core.getInput("planview_api_url"), core.getInput("planview_auth")); + const pvc = new PlanviewClient(core.getInput("planview_api_url"), core.getInput("planview_auth")); const boardId = core.getInput("planview_board_id"); const laneId = core.getInput("planview_lane_id"); const typeId = core.getInput("planview_type_id"); diff --git a/src/planview_client.js b/src/planview-client.js similarity index 100% rename from src/planview_client.js rename to src/planview-client.js