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

View file

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