2021-06-25 14:46:02 +02:00
|
|
|
module AwsMock {
|
|
|
|
const aws: any = {}
|
|
|
|
|
2022-01-20 09:17:08 +01:00
|
|
|
const response = (body: any) => () => ({ promise: () => body })
|
2021-06-25 14:46:02 +02:00
|
|
|
|
|
|
|
function DocumentClient() {
|
|
|
|
// @ts-ignore
|
|
|
|
this.put = jest.fn(response({}))
|
|
|
|
// @ts-ignore
|
|
|
|
this.query = jest.fn(
|
|
|
|
response({
|
|
|
|
Items: [],
|
|
|
|
})
|
|
|
|
)
|
|
|
|
// @ts-ignore
|
|
|
|
this.scan = jest.fn(
|
|
|
|
response({
|
|
|
|
Items: [
|
|
|
|
{
|
|
|
|
Name: "test",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|
|
|
|
)
|
|
|
|
// @ts-ignore
|
|
|
|
this.get = jest.fn(response({}))
|
|
|
|
// @ts-ignore
|
|
|
|
this.update = jest.fn(response({}))
|
|
|
|
// @ts-ignore
|
|
|
|
this.delete = jest.fn(response({}))
|
|
|
|
}
|
|
|
|
|
|
|
|
function S3() {
|
|
|
|
// @ts-ignore
|
|
|
|
this.listObjects = jest.fn(
|
|
|
|
response({
|
|
|
|
Contents: {},
|
|
|
|
})
|
|
|
|
)
|
2022-08-30 20:17:10 +02:00
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
this.createBucket = jest.fn(
|
|
|
|
response({
|
|
|
|
Contents: {},
|
|
|
|
})
|
|
|
|
)
|
2021-06-25 14:46:02 +02:00
|
|
|
}
|
|
|
|
|
2022-01-20 09:17:08 +01:00
|
|
|
aws.DynamoDB = { DocumentClient }
|
2021-06-25 14:46:02 +02:00
|
|
|
aws.S3 = S3
|
2022-01-20 09:17:08 +01:00
|
|
|
aws.config = { update: jest.fn() }
|
2021-06-25 14:46:02 +02:00
|
|
|
|
|
|
|
module.exports = aws
|
2022-01-20 09:17:08 +01:00
|
|
|
}
|