|
|
|
@ -18,10 +18,12 @@ beforeAll(async () => { |
|
|
|
|
|
|
|
afterAll(setup.afterAll) |
|
|
|
|
|
|
|
async function makeRequest(method, endpoint, body, appId) { |
|
|
|
async function makeRequest(method, endpoint, body, appId = config.getAppId()) { |
|
|
|
const extraHeaders = { |
|
|
|
"x-budibase-api-key": apiKey, |
|
|
|
"x-budibase-app-id": appId ? appId : config.getAppId(), |
|
|
|
} |
|
|
|
if (appId) { |
|
|
|
extraHeaders["x-budibase-app-id"] = appId |
|
|
|
} |
|
|
|
const req = request |
|
|
|
[method](checkSlashesInUrl(`/api/public/v1/${endpoint}`)) |
|
|
|
@ -39,36 +41,115 @@ describe("check the applications endpoints", () => { |
|
|
|
const res = await makeRequest("post", "/applications/search") |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow creating an application", async () => { |
|
|
|
const res = await makeRequest("post", "/applications", { |
|
|
|
name: "new App" |
|
|
|
}, null) |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow updating an application", async () => { |
|
|
|
const app = config.getApp() |
|
|
|
const appId = config.getAppId() |
|
|
|
const res = await makeRequest("put", `/applications/${appId}`, { |
|
|
|
...app, |
|
|
|
name: "updated app name", |
|
|
|
}, appId) |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow retrieving an application", async () => { |
|
|
|
const res = await makeRequest("get", `/applications/${config.getAppId()}`) |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow deleting an application", async () => { |
|
|
|
const res = await makeRequest("delete", `/applications/${config.getAppId()}`) |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe("check the tables endpoints", () => { |
|
|
|
it("should allow retrieving applications through search", async () => { |
|
|
|
it("should allow retrieving tables through search", async () => { |
|
|
|
const res = await makeRequest("post", "/tables/search") |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow creating a table", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow updating a table", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow retrieving a table", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow deleting a table", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe("check the rows endpoints", () => { |
|
|
|
it("should allow retrieving applications through search", async () => { |
|
|
|
it("should allow retrieving rows through search", async () => { |
|
|
|
const res = await makeRequest("post", `/tables/${table._id}/rows/search`, { |
|
|
|
query: { |
|
|
|
}, |
|
|
|
}) |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow creating a row", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow updating a row", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow retrieving a row", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow deleting a row", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe("check the users endpoints", () => { |
|
|
|
it("should allow retrieving applications through search", async () => { |
|
|
|
it("should allow retrieving users through search", async () => { |
|
|
|
const res = await makeRequest("post", "/users/search") |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow creating a user", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow updating a user", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow retrieving a user", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow deleting a user", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe("check the queries endpoints", () => { |
|
|
|
it("should allow retrieving applications through search", async () => { |
|
|
|
it("should allow retrieving queries through search", async () => { |
|
|
|
const res = await makeRequest("post", "/queries/search") |
|
|
|
expect(res).toSatisfyApiSpec() |
|
|
|
}) |
|
|
|
|
|
|
|
it("should allow executing a query", async () => { |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|