fix failing lint and test errors

This commit is contained in:
ddivad195
2024-01-30 16:13:51 +00:00
committed by Edwin Sirko
parent 50e278b239
commit 6233cad2a5
11 changed files with 17 additions and 50 deletions
-1
View File
@@ -1,6 +1,5 @@
import * as fsHelper from '../src/fs-helper'
import * as fs from 'fs'
import * as path from 'path'
import * as os from 'os'
import { execSync } from 'child_process'
+3 -4
View File
@@ -12,7 +12,6 @@ let axiosHeadMock: jest.SpyInstance
const token = 'test-token'
const registry = new URL('https://ghcr.io')
const repository = 'test-org/test-repo'
const releaseId = 'test-release-id'
const semver = '1.2.3'
const genericSha = '1234567890' // We should look at using different shas here to catch bug, but that make location validation harder
const zipFile: fsHelper.FileMetadata = {
@@ -119,7 +118,7 @@ describe('publishOCIArtifact', () => {
if ((url as string).includes('manifest')) {
return {
status: 201,
headers: { 'Docker-Content-Digest': '1234567678' }
headers: { 'docker-content-digest': '1234567678' }
}
}
@@ -175,7 +174,7 @@ describe('publishOCIArtifact', () => {
if ((url as string).includes('manifest')) {
return {
status: 201,
headers: { 'Docker-Content-Digest': '1234567678' }
headers: { 'docker-content-digest': '1234567678' }
}
}
@@ -244,7 +243,7 @@ describe('publishOCIArtifact', () => {
if ((url as string).includes('manifest')) {
return {
status: 201,
headers: { 'Docker-Content-Digest': '1234567678' }
headers: { 'docker-content-digest': '1234567678' }
}
}
+2 -4
View File
@@ -15,7 +15,6 @@ import * as ghcr from '../src/ghcr-client'
import * as api from '../src/api-client'
// Mock the GitHub Actions core library
let getInputMock: jest.SpyInstance
let setFailedMock: jest.SpyInstance
let setOutputMock: jest.SpyInstance
@@ -37,7 +36,6 @@ describe('run', () => {
jest.clearAllMocks()
// Core mocks
getInputMock = jest.spyOn(core, 'getInput').mockImplementation()
setFailedMock = jest.spyOn(core, 'setFailed').mockImplementation()
setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
@@ -113,7 +111,7 @@ describe('run', () => {
const invalidEvents = ['workflow_dispatch, pull_request, schedule']
for (const event of invalidEvents) {
github.context.eventName = event
await main.run('')
await main.run()
expect(setFailedMock).toHaveBeenCalledWith(
'This action can only be triggered by release events or tag push events.'
)
@@ -357,7 +355,7 @@ describe('run', () => {
publishOCIArtifactMock.mockImplementation(() => {
return {
packageURL: 'https://ghcr.io/v2/test-org/test-repo:1.2.3',
manifestDigest: 'my-test-digest'
manifestDigest: 'sha256:my-test-digest'
}
})