* file auth wip * Private plugin bucket wip * Add etag to logo request, fix circular dependency * Resolve cyclic dependency * Ensure browser doesn't cache custom component * Global file fixes * File fixes / remove permaUrl * Add ctx local storage * Enable presigned url to work from any host * Test fix * Self hosting w/ S3 + other fixes * Fix for serving dev app in multi tenant * Fix backup restore and import attachment url processing, never store attachment urls * Test fixes * Unit tests WIP * Replace file path with base64 encoded private key * Multi tenancy tests for files * Environment files fixes * Post-merge build and test fixes * Add debug conditional to all jest logging and revert/fix prod minio proxy_pass * Re-add default '/' minio route :( * Rename iconFile -> iconFileName * Add cloudfront vars to k8s templates * Remove public bucket policy * Remove duplicated test
80 lines
1.4 KiB
TypeScript
80 lines
1.4 KiB
TypeScript
module AwsMock {
|
|
const aws: any = {}
|
|
|
|
const response = (body: any) => () => ({ promise: () => body })
|
|
|
|
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: {},
|
|
})
|
|
)
|
|
|
|
// @ts-ignore
|
|
this.createBucket = jest.fn(
|
|
response({
|
|
Contents: {},
|
|
})
|
|
)
|
|
|
|
// @ts-ignore
|
|
this.deleteObjects = jest.fn(
|
|
response({
|
|
Contents: {},
|
|
})
|
|
)
|
|
|
|
// @ts-ignore
|
|
this.getSignedUrl = (operation, params) => {
|
|
return `http://test.com/${params.Bucket}/${params.Key}`
|
|
}
|
|
|
|
// @ts-ignore
|
|
this.headBucket = jest.fn(
|
|
response({
|
|
Contents: {},
|
|
})
|
|
)
|
|
|
|
// @ts-ignore
|
|
this.upload = jest.fn(
|
|
response({
|
|
Contents: {},
|
|
})
|
|
)
|
|
}
|
|
|
|
aws.DynamoDB = { DocumentClient }
|
|
aws.S3 = S3
|
|
aws.config = { update: jest.fn() }
|
|
|
|
module.exports = aws
|
|
}
|