Merge branch 'develop' into feature/app-quotas

This commit is contained in:
Rory Powell 2022-09-28 12:33:39 +01:00
commit 98168aee29
2 changed files with 20 additions and 20 deletions

View File

@ -68,7 +68,7 @@ export function getQueryIndex(viewName: ViewName) {
* Check if a given ID is that of a table.
* @returns {boolean}
*/
exports.isTableId = (id: string) => {
export const isTableId = (id: string) => {
// this includes datasource plus tables
return (
id &&
@ -81,7 +81,7 @@ exports.isTableId = (id: string) => {
* Check if a given ID is that of a datasource or datasource plus.
* @returns {boolean}
*/
exports.isDatasourceId = (id: string) => {
export const isDatasourceId = (id: string) => {
// this covers both datasources and datasource plus
return id && id.startsWith(`${DocumentType.DATASOURCE}${SEPARATOR}`)
}

View File

@ -55,26 +55,26 @@ describe("/rows", () => {
describe("save, load, update", () => {
it("returns a success message when the row is created", async () => {
// const rowUsage = await getRowUsage()
// const queryUsage = await getQueryUsage()
//
// const res = await request
// .post(`/api/${row.tableId}/rows`)
// .send(row)
// .set(config.defaultHeaders())
// .expect('Content-Type', /json/)
// .expect(200)
// expect(res.res.statusMessage).toEqual(`${table.name} saved successfully`)
// expect(res.body.name).toEqual("Test Contact")
// expect(res.body._rev).toBeDefined()
// await assertRowUsage(rowUsage + 1)
// await assertQueryUsage(queryUsage + 1)
const rowUsage = await getRowUsage()
const queryUsage = await getQueryUsage()
const res = await request
.post(`/api/${row.tableId}/rows`)
.send(row)
.set(config.defaultHeaders())
.expect('Content-Type', /json/)
.expect(200)
expect(res.res.statusMessage).toEqual(`${table.name} saved successfully`)
expect(res.body.name).toEqual("Test Contact")
expect(res.body._rev).toBeDefined()
await assertRowUsage(rowUsage + 1)
await assertQueryUsage(queryUsage + 1)
})
it("updates a row successfully", async () => {
const existing = await config.createRow()
// const rowUsage = await getRowUsage()
// const queryUsage = await getQueryUsage()
const rowUsage = await getRowUsage()
const queryUsage = await getQueryUsage()
const res = await request
.post(`/api/${table._id}/rows`)
@ -92,8 +92,8 @@ describe("/rows", () => {
`${table.name} updated successfully.`
)
expect(res.body.name).toEqual("Updated Name")
// await assertRowUsage(rowUsage)
// await assertQueryUsage(queryUsage + 1)
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage + 1)
})
it("should load a row", async () => {