1
0
Fork 0
mirror of synced 2024-08-09 15:17:57 +12:00

Timeout issues

This commit is contained in:
Adria Navarro 2023-09-13 13:17:51 +02:00
parent dc5cd7cf76
commit c530d5fa34
2 changed files with 13 additions and 9 deletions

View file

@ -21,8 +21,6 @@ import { databaseTestProviders } from "../integrations/tests/utils"
const config = setup.getConfig()!
jest.setTimeout(30000)
jest.unmock("pg")
jest.mock("../websockets")
@ -39,13 +37,13 @@ describe("postgres integrations", () => {
const apiKey = await config.generateApiKey()
makeRequest = generateMakeRequest(apiKey, true)
})
beforeEach(async () => {
postgresDatasource = await config.api.datasource.create(
await databaseTestProviders.postgres.getDsConfig()
)
})
beforeEach(async () => {
async function createAuxTable(prefix: string) {
return await config.createTable({
name: `${prefix}_${generator.word({ length: 6 })}`,
@ -345,12 +343,16 @@ describe("postgres integrations", () => {
it("multiple rows can be persisted", async () => {
const numberOfRows = 10
const newRows = Array(numberOfRows).fill(generateRandomPrimaryRowData())
const newRows: Row[] = Array(numberOfRows).fill(
generateRandomPrimaryRowData()
)
for (const newRow of newRows) {
const res = await createRow(primaryPostgresTable._id, newRow)
expect(res.status).toBe(200)
}
await Promise.all(
newRows.map(async newRow => {
const res = await createRow(primaryPostgresTable._id, newRow)
expect(res.status).toBe(200)
})
)
const persistedRows = await config.getRows(primaryPostgresTable._id!)
expect(persistedRows).toHaveLength(numberOfRows)

View file

@ -3,6 +3,8 @@ jest.unmock("pg")
import { Datasource } from "@budibase/types"
import * as pg from "./postgres"
jest.setTimeout(30000)
export interface DatabasePlusTestProvider {
getDsConfig(): Promise<Datasource>
}