From f98ccd1e39093913ef977bfe94a5505fdc38ae24 Mon Sep 17 00:00:00 2001 From: Vallie Joseph Date: Tue, 9 Apr 2024 18:21:41 +0000 Subject: [PATCH] updating tests --- packages/artifact/__tests__/upload-artifact.test.ts | 11 ++++++++++- packages/artifact/package-lock.json | 9 +++++++++ packages/artifact/package.json | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/artifact/__tests__/upload-artifact.test.ts b/packages/artifact/__tests__/upload-artifact.test.ts index 4c825438..e90e6160 100644 --- a/packages/artifact/__tests__/upload-artifact.test.ts +++ b/packages/artifact/__tests__/upload-artifact.test.ts @@ -9,7 +9,7 @@ import {uploadArtifact} from '../src/internal/upload/upload-artifact' import {noopLogs} from './common' import {FilesNotFoundError} from '../src/internal/shared/errors' import {BlockBlobClient} from '@azure/storage-blob' - +import mockFs from 'mock-fs' describe('upload-artifact', () => { beforeEach(() => { noopLogs() @@ -374,6 +374,15 @@ describe('upload-artifact', () => { destinationPath: 'dir/file3.txt' } ]) + mockFs({ + '/home/user/files/plz-upload': { + 'file1.txt': 'file1 content', + 'file2.txt': 'file2 content', + dir: { + 'file3.txt': 'file3 content' + } + } + }) jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({ workflowRunBackendId: '1234', diff --git a/packages/artifact/package-lock.json b/packages/artifact/package-lock.json index 4eebe9e5..907ceff3 100644 --- a/packages/artifact/package-lock.json +++ b/packages/artifact/package-lock.json @@ -21,6 +21,7 @@ "archiver": "^7.0.1", "crypto": "^1.0.1", "jwt-decode": "^3.1.2", + "mock-fs": "^5.2.0", "twirp-ts": "^2.5.0", "unzip-stream": "^0.3.1" }, @@ -1224,6 +1225,14 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mock-fs": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-5.2.0.tgz", + "integrity": "sha512-2dF2R6YMSZbpip1V1WHKGLNjr/k48uQClqMVb5H3MOvwc9qhYis3/IWbj02qIg/Y8MDXKFF4c5v0rxx2o6xTZw==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", diff --git a/packages/artifact/package.json b/packages/artifact/package.json index 38878192..140c3ca8 100644 --- a/packages/artifact/package.json +++ b/packages/artifact/package.json @@ -52,6 +52,7 @@ "archiver": "^7.0.1", "crypto": "^1.0.1", "jwt-decode": "^3.1.2", + "mock-fs": "^5.2.0", "twirp-ts": "^2.5.0", "unzip-stream": "^0.3.1" },