Undoing change.

This commit is contained in:
mike12345567 2024-02-28 15:19:55 +00:00
parent 56b1855f6a
commit d471a2bf0f
1 changed files with 1972 additions and 1989 deletions

View File

@ -39,9 +39,10 @@ tk.freeze(timestamp)
const { basicRow } = setup.structures
describe.each([["postgres", databaseTestProviders.postgres]])(
"/rows (%s)",
(__, dsProvider) => {
describe.each([
["internal", undefined],
["postgres", databaseTestProviders.postgres],
])("/rows (%s)", (__, dsProvider) => {
const isInternal = !dsProvider
const request = setup.getRequest()
@ -110,10 +111,7 @@ describe.each([["postgres", databaseTestProviders.postgres]])(
const getRowUsage = async () => {
const { total } = await config.doInContext(null, () =>
quotas.getCurrentUsageValues(
QuotaUsageType.STATIC,
StaticQuotaName.ROWS
)
quotas.getCurrentUsageValues(QuotaUsageType.STATIC, StaticQuotaName.ROWS)
)
return total
}
@ -857,9 +855,7 @@ describe.each([["postgres", databaseTestProviders.postgres]])(
expect(resEnriched.body.link.length).toBe(1)
expect(resEnriched.body.link[0]._id).toBe(firstRow._id)
expect(resEnriched.body.link[0].name).toBe("Test Contact")
expect(resEnriched.body.link[0].description).toBe(
"original description"
)
expect(resEnriched.body.link[0].description).toBe("original description")
await assertRowUsage(rowUsage)
})
})
@ -1411,34 +1407,26 @@ describe.each([["postgres", databaseTestProviders.postgres]])(
it("respects the limit parameter", async () => {
await createTable(await userTable())
await Promise.all(
Array.from({ length: 10 }, () => config.createRow())
)
await Promise.all(Array.from({ length: 10 }, () => config.createRow()))
const limit = generator.integer({ min: 1, max: 8 })
const createViewResponse = await config.createView()
const response = await config.api.viewV2.search(
createViewResponse.id,
{
const response = await config.api.viewV2.search(createViewResponse.id, {
limit,
query: {},
}
)
})
expect(response.body.rows).toHaveLength(limit)
})
it("can handle pagination", async () => {
await createTable(await userTable())
await Promise.all(
Array.from({ length: 10 }, () => config.createRow())
)
await Promise.all(Array.from({ length: 10 }, () => config.createRow()))
const createViewResponse = await config.createView()
const allRows = (
await config.api.viewV2.search(createViewResponse.id)
).body.rows
const allRows = (await config.api.viewV2.search(createViewResponse.id))
.body.rows
const firstPageResponse = await config.api.viewV2.search(
createViewResponse.id,
@ -1750,9 +1738,7 @@ describe.each([["postgres", databaseTestProviders.postgres]])(
name: rowData.name,
description: rowData.description,
tableId,
users: expect.arrayContaining(
selectedUsers.map(u => resultMapper(u))
),
users: expect.arrayContaining(selectedUsers.map(u => resultMapper(u))),
_id: expect.any(String),
_rev: expect.any(String),
id: isInternal ? undefined : expect.any(Number),
@ -1801,9 +1787,7 @@ describe.each([["postgres", databaseTestProviders.postgres]])(
description: rowData.description,
tableId,
user: expect.arrayContaining([user1].map(u => resultMapper(u))),
users: expect.arrayContaining(
[user2, user3].map(u => resultMapper(u))
),
users: expect.arrayContaining([user2, user3].map(u => resultMapper(u))),
_id: row._id,
_rev: expect.any(String),
id: isInternal ? undefined : expect.any(Number),
@ -2195,5 +2179,4 @@ describe.each([["postgres", databaseTestProviders.postgres]])(
)
})
})
}
)
})