1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Fixing mock to cover getReadStream in object store.

This commit is contained in:
mike12345567 2024-02-01 11:09:28 +00:00
parent e61d52ee8b
commit c4eae33b67

View file

@ -1,7 +1,13 @@
import fs from "fs"
import { join } from "path"
module AwsMock {
const aws: any = {}
const response = (body: any) => () => ({ promise: () => body })
const response = (body: any, extra?: any) => () => ({
promise: () => body,
...extra,
})
function DocumentClient() {
// @ts-ignore
@ -73,9 +79,18 @@ module AwsMock {
// @ts-ignore
this.getObject = jest.fn(
response({
Body: "",
})
response(
{
Body: "",
},
{
createReadStream: jest
.fn()
.mockReturnValue(
fs.createReadStream(join(__dirname, "aws-sdk.ts"))
),
}
)
)
}