Skip to content

Commit b19ff43

Browse files
committed
refactor: resolve download path correctly in artifact download tests (mainly for windows unit tests)
1 parent e262cbe commit b19ff43

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

__tests__/download.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as core from '@actions/core'
2+
import * as path from 'path'
23
import artifact, {ArtifactNotFoundError} from '@actions/artifact'
34
import {run} from '../src/download-artifact'
45
import {Inputs} from '../src/constants'
@@ -380,11 +381,12 @@ describe('download', () => {
380381
digest: 'def456'
381382
}
382383

384+
const testPath = '/test/path'
383385
mockInputs({
384386
[Inputs.Name]: '',
385387
[Inputs.Pattern]: '',
386388
[Inputs.ArtifactIds]: '456',
387-
[Inputs.Path]: '/test/path'
389+
[Inputs.Path]: testPath
388390
})
389391

390392
jest.spyOn(artifact, 'listArtifacts').mockImplementation(() =>
@@ -399,7 +401,7 @@ describe('download', () => {
399401
expect(artifact.downloadArtifact).toHaveBeenCalledWith(
400402
456,
401403
expect.objectContaining({
402-
path: '/test/path', // Should be the resolved path directly, not /test/path/test-artifact
404+
path: path.resolve(testPath), // Should be the resolved path directly, not nested
403405
expectedHash: mockArtifact.digest
404406
})
405407
)

0 commit comments

Comments
 (0)