From 7be9d2afad719a9cab6485eb3c403f2acfc6a9cd Mon Sep 17 00:00:00 2001 From: quality Date: Wed, 30 Sep 2026 04:35:43 -0400 Subject: [PATCH 1/2] test(bundle): drive the push event and a blank jobs input through the cron dispatcher in dist/index.js Signed-off-by: quality --- __tests__/bundle/cronJobsInput.test.ts | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 __tests__/bundle/cronJobsInput.test.ts diff --git a/__tests__/bundle/cronJobsInput.test.ts b/__tests__/bundle/cronJobsInput.test.ts new file mode 100644 index 0000000..928996c --- /dev/null +++ b/__tests__/bundle/cronJobsInput.test.ts @@ -0,0 +1,36 @@ +import type { FakeGithub } from './fakeGithub' +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' + +import { start } from './fakeGithub' +import { runBundle } from './runBundle' + +vi.setConfig({ testTimeout: 30_000 }) + +// the `jobs` input validation of the cron dispatcher, driven through dist/index.js: the push event routes to the +// cron jobs like schedule and workflow_dispatch do, and a blank list fails the run before anything talks to the api +describe('dist/index.js cron jobs input', () => { + const token = { 'github-token': 'some-token' } + let gh: FakeGithub + + beforeAll(async () => { + gh = await start() + }) + afterEach(() => gh.reset()) + afterAll(() => gh.close()) + + it('push without a jobs input fails the run naming the missing list and calls no api', async () => { + const result = await runBundle({ eventName: 'push', payload: {}, inputs: token, apiUrl: gh.url }) + + expect(result.status, result.stdout).toBe(1) + expect(result.errors.some(e => /please provide a list of space delimited/.test(e))).toBe(true) + expect(gh.requests).toEqual([]) + }) + + it('a jobs input of only whitespace is treated as missing', async () => { + const result = await runBundle({ eventName: 'schedule', payload: {}, inputs: { ...token, jobs: ' \n\t ' }, apiUrl: gh.url }) + + expect(result.status, result.stdout).toBe(1) + expect(result.errors.some(e => /please provide a list of space delimited/.test(e))).toBe(true) + expect(gh.requests).toEqual([]) + }) +}) From 825708351908398f8f278d24bc85b06313461135 Mon Sep 17 00:00:00 2001 From: quality Date: Sat, 3 Oct 2026 15:49:34 -0400 Subject: [PATCH 2/2] test(bundle): import token from the shared bundle helpers Signed-off-by: quality --- __tests__/bundle/cronJobsInput.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/bundle/cronJobsInput.test.ts b/__tests__/bundle/cronJobsInput.test.ts index 928996c..3a52e0d 100644 --- a/__tests__/bundle/cronJobsInput.test.ts +++ b/__tests__/bundle/cronJobsInput.test.ts @@ -2,6 +2,7 @@ import type { FakeGithub } from './fakeGithub' import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' import { start } from './fakeGithub' +import { token } from './helpers' import { runBundle } from './runBundle' vi.setConfig({ testTimeout: 30_000 }) @@ -9,7 +10,6 @@ vi.setConfig({ testTimeout: 30_000 }) // the `jobs` input validation of the cron dispatcher, driven through dist/index.js: the push event routes to the // cron jobs like schedule and workflow_dispatch do, and a blank list fails the run before anything talks to the api describe('dist/index.js cron jobs input', () => { - const token = { 'github-token': 'some-token' } let gh: FakeGithub beforeAll(async () => {