1
0
Fork 0

updating tests

pull/1712/head
Vallie Joseph 2024-04-09 18:21:41 +00:00
parent 7f0a981b2e
commit f98ccd1e39
3 changed files with 20 additions and 1 deletions

View File

@ -9,7 +9,7 @@ import {uploadArtifact} from '../src/internal/upload/upload-artifact'
import {noopLogs} from './common' import {noopLogs} from './common'
import {FilesNotFoundError} from '../src/internal/shared/errors' import {FilesNotFoundError} from '../src/internal/shared/errors'
import {BlockBlobClient} from '@azure/storage-blob' import {BlockBlobClient} from '@azure/storage-blob'
import mockFs from 'mock-fs'
describe('upload-artifact', () => { describe('upload-artifact', () => {
beforeEach(() => { beforeEach(() => {
noopLogs() noopLogs()
@ -374,6 +374,15 @@ describe('upload-artifact', () => {
destinationPath: 'dir/file3.txt' 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({ jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
workflowRunBackendId: '1234', workflowRunBackendId: '1234',

View File

@ -21,6 +21,7 @@
"archiver": "^7.0.1", "archiver": "^7.0.1",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"mock-fs": "^5.2.0",
"twirp-ts": "^2.5.0", "twirp-ts": "^2.5.0",
"unzip-stream": "^0.3.1" "unzip-stream": "^0.3.1"
}, },
@ -1224,6 +1225,14 @@
"mkdirp": "bin/cmd.js" "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": { "node_modules/neo-async": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",

View File

@ -52,6 +52,7 @@
"archiver": "^7.0.1", "archiver": "^7.0.1",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"mock-fs": "^5.2.0",
"twirp-ts": "^2.5.0", "twirp-ts": "^2.5.0",
"unzip-stream": "^0.3.1" "unzip-stream": "^0.3.1"
}, },