Fixes #357 Use a read stream for artifacts.
Some checks failed
Test / check_pr (push) Has been cancelled
Some checks failed
Test / check_pr (push) Has been cancelled
This seems to be safe since octokit mentions ReadableStreams in their fetcher wrapper & tests: https://github.com/octokit/request.js/blob/main/src/fetch-wrapper.ts#L44 (and also it seems to work when I test it).
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import { Artifact } from "../src/Artifact";
|
||||
import {Artifact} from "../src/Artifact";
|
||||
|
||||
const fileContents = Buffer.from('artful facts', 'utf-8')
|
||||
const contentLength = 42
|
||||
const fakeReadStream = {}
|
||||
|
||||
jest.mock('fs', () => {
|
||||
return {
|
||||
readFileSync: () => fileContents,
|
||||
statSync: () => { return { size: contentLength } }
|
||||
createReadStream: () => fakeReadStream,
|
||||
statSync: () => {
|
||||
return {size: contentLength}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
@@ -33,6 +35,6 @@ describe("Artifact", () => {
|
||||
|
||||
it('reads artifact', () => {
|
||||
const artifact = new Artifact('some/artifact')
|
||||
expect(artifact.readFile()).toBe(fileContents)
|
||||
expect(artifact.readFile()).toBe(fakeReadStream)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user