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 {
|
module AwsMock {
|
||||||
const aws: any = {}
|
const aws: any = {}
|
||||||
|
|
||||||
const response = (body: any) => () => ({ promise: () => body })
|
const response = (body: any, extra?: any) => () => ({
|
||||||
|
promise: () => body,
|
||||||
|
...extra,
|
||||||
|
})
|
||||||
|
|
||||||
function DocumentClient() {
|
function DocumentClient() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -73,9 +79,18 @@ module AwsMock {
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.getObject = jest.fn(
|
this.getObject = jest.fn(
|
||||||
response({
|
response(
|
||||||
|
{
|
||||||
Body: "",
|
Body: "",
|
||||||
})
|
},
|
||||||
|
{
|
||||||
|
createReadStream: jest
|
||||||
|
.fn()
|
||||||
|
.mockReturnValue(
|
||||||
|
fs.createReadStream(join(__dirname, "aws-sdk.ts"))
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue