Files
attest/__tests__/index.test.ts
T
Brian DeHamer e1605dcab6 esm'ify jest tests
Signed-off-by: Brian DeHamer <bdehamer@github.com>
2026-02-13 16:07:58 -08:00

36 lines
773 B
TypeScript

/**
* Unit tests for the action's entrypoint, src/index.ts
*/
import { jest } from '@jest/globals'
// Mock functions
const mockRun = jest.fn()
const mockGetInput = jest.fn()
const mockGetBooleanInput = jest.fn()
// Mock @actions/core
jest.unstable_mockModule('@actions/core', () => ({
getInput: mockGetInput,
getBooleanInput: mockGetBooleanInput
}))
// Mock ../src/main
jest.unstable_mockModule('../src/main', () => ({
run: mockRun
}))
describe('index', () => {
beforeEach(() => {
jest.clearAllMocks()
mockGetBooleanInput.mockReturnValue(false)
mockGetInput.mockReturnValue('')
})
it('calls run when imported', async () => {
// Dynamic import after mocking
await import('../src/index')
expect(mockRun).toHaveBeenCalled()
})
})