Timeout issues
This commit is contained in:
parent
dc5cd7cf76
commit
c530d5fa34
|
@ -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(
|
||||||
const res = await createRow(primaryPostgresTable._id, newRow)
|
newRows.map(async newRow => {
|
||||||
expect(res.status).toBe(200)
|
const res = await createRow(primaryPostgresTable._id, newRow)
|
||||||
}
|
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)
|
||||||
|
|
|
@ -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>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue