Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.4 KiB

const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
const setup = require("./utilities")
const { basicLayout } = require("./utilities/structures")
describe("/layouts", () => {
let request = setup.getRequest()
let config = setup.getConfig()
let layout
afterAll(setup.afterAll)
beforeEach(async () => {
await config.init()
layout = await config.createLayout()
})
describe("save", () => {
it("should be able to create a layout", async () => {
const res = await request
.post(`/api/layouts`)
.send(basicLayout())
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
expect(res.body._rev).toBeDefined()
})
it("should apply authorization to endpoint", async () => {
await checkBuilderEndpoint({
config,
method: "POST",
url: `/api/layouts`,
})
})
})
describe("destroy", () => {
it("should be able to delete the layout", async () => {
const res = await request
.delete(`/api/layouts/${layout._id}/${layout._rev}`)
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
expect(res.body.message).toBeDefined()
})
it("should apply authorization to endpoint", async () => {
await checkBuilderEndpoint({
config,
method: "DELETE",
url: `/api/layouts/${layout._id}/${layout._rev}`,
})
})
})
})