From b19ff4302770b82aa4694b63703b547756dacce6 Mon Sep 17 00:00:00 2001 From: GrantBirki Date: Tue, 5 Aug 2025 11:26:03 -0700 Subject: [PATCH] refactor: resolve download path correctly in artifact download tests (mainly for windows unit tests) --- __tests__/download.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/__tests__/download.test.ts b/__tests__/download.test.ts index 8901ac3..0709fbe 100644 --- a/__tests__/download.test.ts +++ b/__tests__/download.test.ts @@ -1,4 +1,5 @@ import * as core from '@actions/core' +import * as path from 'path' import artifact, {ArtifactNotFoundError} from '@actions/artifact' import {run} from '../src/download-artifact' import {Inputs} from '../src/constants' @@ -380,11 +381,12 @@ describe('download', () => { digest: 'def456' } + const testPath = '/test/path' mockInputs({ [Inputs.Name]: '', [Inputs.Pattern]: '', [Inputs.ArtifactIds]: '456', - [Inputs.Path]: '/test/path' + [Inputs.Path]: testPath }) jest.spyOn(artifact, 'listArtifacts').mockImplementation(() => @@ -399,7 +401,7 @@ describe('download', () => { expect(artifact.downloadArtifact).toHaveBeenCalledWith( 456, expect.objectContaining({ - path: '/test/path', // Should be the resolved path directly, not /test/path/test-artifact + path: path.resolve(testPath), // Should be the resolved path directly, not nested expectedHash: mockArtifact.digest }) )