Files
attest/__tests__/index.test.ts
T

36 lines
773 B
TypeScript
Raw Normal View History

/**
* Unit tests for the action's entrypoint, src/index.ts
*/
2026-02-18 08:52:30 -08:00
import { jest } from '@jest/globals'
2026-02-18 08:52:30 -08:00
// Mock functions
const mockRun = jest.fn()
const mockGetInput = jest.fn()
const mockGetBooleanInput = jest.fn()
2026-02-18 08:52:30 -08:00
// 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(() => {
2026-02-18 08:52:30 -08:00
jest.clearAllMocks()
mockGetBooleanInput.mockReturnValue(false)
mockGetInput.mockReturnValue('')
})
2026-02-18 08:52:30 -08:00
it('calls run when imported', async () => {
// Dynamic import after mocking
await import('../src/index')
expect(mockRun).toHaveBeenCalled()
})
})