1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

Adding test cases for backup and integration.

This commit is contained in:
mike12345567 2021-03-09 16:28:41 +00:00
parent daaf352b89
commit 61110be9d0
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,32 @@
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
const setup = require("./utilities")
describe("/backups", () => {
let request = setup.getRequest()
let config = setup.getConfig()
afterAll(setup.afterAll)
beforeEach(async () => {
await config.init()
})
describe("exportAppDump", () => {
it("should be able to export app", async () => {
const res = await request
.get(`/api/backups/export?appId=${config.getAppId()}`)
.set(config.defaultHeaders())
.expect(200)
expect(res.text).toBeDefined()
expect(res.text.includes(`"db_name":"${config.getAppId()}"`)).toEqual(true)
})
it("should apply authorization to endpoint", async () => {
await checkBuilderEndpoint({
config,
method: "GET",
url: `/api/backups/export?appId=${config.getAppId()}`,
})
})
})
})

View file

@ -0,0 +1,52 @@
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
const setup = require("./utilities")
describe("/integrations", () => {
let request = setup.getRequest()
let config = setup.getConfig()
afterAll(setup.afterAll)
beforeEach(async () => {
await config.init()
})
describe("fetch", () => {
it("should be able to get all integration definitions", async () => {
const res = await request
.get(`/api/integrations`)
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
expect(res.body.POSTGRES).toBeDefined()
expect(res.body.POSTGRES.friendlyName).toEqual("PostgreSQL")
})
it("should apply authorization to endpoint", async () => {
await checkBuilderEndpoint({
config,
method: "GET",
url: `/api/integrations`,
})
})
})
describe("find", () => {
it("should be able to get postgres definition", async () => {
const res = await request
.get(`/api/integrations/POSTGRES`)
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
expect(res.body.friendlyName).toEqual("PostgreSQL")
})
it("should apply authorization to endpoint", async () => {
await checkBuilderEndpoint({
config,
method: "GET",
url: `/api/integrations/POSTGRES`,
})
})
})
})