mirror of
https://github.com/actions/attest-build-provenance.git
synced 2025-12-16 12:19:04 +00:00
updated
This commit is contained in:
parent
0ef8756d7e
commit
2996ccccce
39
__tests__/__snapshots__/main.test.ts.snap
Normal file
39
__tests__/__snapshots__/main.test.ts.snap
Normal file
@ -0,0 +1,39 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`main successfully run main 1`] = `
|
||||
{
|
||||
"buildDefinition": {
|
||||
"buildType": "https://slsa-framework.github.io/github-actions-buildtypes/workflow/v1",
|
||||
"externalParameters": {
|
||||
"workflow": {
|
||||
"path": ".github/workflows/main.yml",
|
||||
"ref": "main",
|
||||
"repository": "https://github.com/owner/repo",
|
||||
},
|
||||
},
|
||||
"internalParameters": {
|
||||
"github": {
|
||||
"event_name": "push",
|
||||
"repository_id": "repo-id",
|
||||
"repository_owner_id": "owner-id",
|
||||
},
|
||||
},
|
||||
"resolvedDependencies": [
|
||||
{
|
||||
"digest": {
|
||||
"gitCommit": "babca52ab0c93ae16539e5923cb0d7403b9a093b",
|
||||
},
|
||||
"uri": "git+https://github.com/owner/repo@refs/heads/main",
|
||||
},
|
||||
],
|
||||
},
|
||||
"runDetails": {
|
||||
"builder": {
|
||||
"id": "https://github.com/actions/runner/github-hosted",
|
||||
},
|
||||
"metadata": {
|
||||
"invocationId": "https://github.com/owner/repo/actions/runs/run-id/attempts/run-attempt",
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
@ -9,7 +9,7 @@ const setFailedMock = jest.spyOn(core, 'setFailed')
|
||||
// Ensure that setFailed doesn't set an exit code during tests
|
||||
setFailedMock.mockImplementation(() => {})
|
||||
|
||||
describe('main action', () => {
|
||||
describe('main', () => {
|
||||
let outputs = {} as Record<string, string>
|
||||
|
||||
beforeEach(() => {
|
||||
@ -46,51 +46,8 @@ describe('main action', () => {
|
||||
// Verify that outputs were set correctly
|
||||
expect(setOutputMock).toHaveBeenCalledTimes(2)
|
||||
|
||||
// Define the expected object
|
||||
const expectedObject = {
|
||||
buildDefinition: {
|
||||
buildType:
|
||||
'https://slsa-framework.github.io/github-actions-buildtypes/workflow/v1',
|
||||
externalParameters: {
|
||||
workflow: {
|
||||
path: '.github/workflows/main.yml',
|
||||
ref: 'main',
|
||||
repository: 'https://github.com/owner/repo'
|
||||
}
|
||||
},
|
||||
internalParameters: {
|
||||
github: {
|
||||
event_name: 'push',
|
||||
repository_id: 'repo-id',
|
||||
repository_owner_id: 'owner-id'
|
||||
}
|
||||
},
|
||||
resolvedDependencies: [
|
||||
{
|
||||
digest: {
|
||||
gitCommit: 'babca52ab0c93ae16539e5923cb0d7403b9a093b'
|
||||
},
|
||||
uri: 'git+https://github.com/owner/repo@refs/heads/main'
|
||||
}
|
||||
]
|
||||
},
|
||||
runDetails: {
|
||||
builder: {
|
||||
id: 'https://github.com/actions/runner/github-hosted'
|
||||
},
|
||||
metadata: {
|
||||
invocationId:
|
||||
'https://github.com/owner/repo/actions/runs/run-id/attempts/run-attempt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Use the expected object in the test assertion
|
||||
expect(setOutputMock).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'predicate',
|
||||
expectedObject
|
||||
)
|
||||
expect(outputs['predicate']).toMatchSnapshot()
|
||||
|
||||
expect(setOutputMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user