Remove mocks

This commit is contained in:
Adria Navarro 2023-01-24 17:48:49 +00:00
parent 26fa3bd484
commit 9371f19419
3 changed files with 11 additions and 94 deletions

View File

@ -1,80 +0,0 @@
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
}

View File

@ -1,13 +1,3 @@
jest.mock("@budibase/backend-core", () => {
const core = jest.requireActual("@budibase/backend-core")
return {
...core,
objectStore: {
budibaseTempDir: core.objectStore.budibaseTempDir,
},
}
})
import * as setup from "./utilities"
import { events } from "@budibase/backend-core"
import sdk from "../../../sdk"

View File

@ -137,15 +137,22 @@ class TestConfiguration {
return this.createApp(appName)
}
end() {
async end() {
if (!this) {
return
}
if (this.server) {
this.server.close()
}
if (this.allApps) {
cleanup(this.allApps.map(app => app.appId))
await this._req(
null,
{ appId: this.prodApp.appId },
controllers.app.destroy
)
}
if (this.server) {
this.server.close()
}
}