Fixing mock to cover getReadStream in object store.
This commit is contained in:
parent
e61d52ee8b
commit
c4eae33b67
|
@ -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({
|
||||
response(
|
||||
{
|
||||
Body: "",
|
||||
})
|
||||
},
|
||||
{
|
||||
createReadStream: jest
|
||||
.fn()
|
||||
.mockReturnValue(
|
||||
fs.createReadStream(join(__dirname, "aws-sdk.ts"))
|
||||
),
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue