Fix tests after merge

This commit is contained in:
adrinr 2023-02-02 10:43:18 +00:00
parent 4eb0c07953
commit 3328c908ff
3 changed files with 35 additions and 31 deletions

View File

@ -817,6 +817,7 @@
"type": "string", "type": "string",
"enum": [ "enum": [
"string", "string",
"barcodeqr",
"longform", "longform",
"options", "options",
"number", "number",
@ -828,8 +829,7 @@
"formula", "formula",
"auto", "auto",
"json", "json",
"internal", "internal"
"barcodeqr"
], ],
"description": "Defines the type of the column, most explain themselves, a link column is a relationship." "description": "Defines the type of the column, most explain themselves, a link column is a relationship."
}, },
@ -1021,6 +1021,7 @@
"type": "string", "type": "string",
"enum": [ "enum": [
"string", "string",
"barcodeqr",
"longform", "longform",
"options", "options",
"number", "number",
@ -1032,8 +1033,7 @@
"formula", "formula",
"auto", "auto",
"json", "json",
"internal", "internal"
"barcodeqr"
], ],
"description": "Defines the type of the column, most explain themselves, a link column is a relationship." "description": "Defines the type of the column, most explain themselves, a link column is a relationship."
}, },
@ -1236,6 +1236,7 @@
"type": "string", "type": "string",
"enum": [ "enum": [
"string", "string",
"barcodeqr",
"longform", "longform",
"options", "options",
"number", "number",
@ -1247,8 +1248,7 @@
"formula", "formula",
"auto", "auto",
"json", "json",
"internal", "internal"
"barcodeqr"
], ],
"description": "Defines the type of the column, most explain themselves, a link column is a relationship." "description": "Defines the type of the column, most explain themselves, a link column is a relationship."
}, },

View File

@ -603,6 +603,7 @@ components:
type: string type: string
enum: enum:
- string - string
- barcodeqr
- longform - longform
- options - options
- number - number
@ -615,7 +616,6 @@ components:
- auto - auto
- json - json
- internal - internal
- barcodeqr
description: Defines the type of the column, most explain themselves, a link description: Defines the type of the column, most explain themselves, a link
column is a relationship. column is a relationship.
constraints: constraints:
@ -766,6 +766,7 @@ components:
type: string type: string
enum: enum:
- string - string
- barcodeqr
- longform - longform
- options - options
- number - number
@ -778,7 +779,6 @@ components:
- auto - auto
- json - json
- internal - internal
- barcodeqr
description: Defines the type of the column, most explain themselves, a link description: Defines the type of the column, most explain themselves, a link
column is a relationship. column is a relationship.
constraints: constraints:
@ -936,6 +936,7 @@ components:
type: string type: string
enum: enum:
- string - string
- barcodeqr
- longform - longform
- options - options
- number - number
@ -948,7 +949,6 @@ components:
- auto - auto
- json - json
- internal - internal
- barcodeqr
description: Defines the type of the column, most explain themselves, a link description: Defines the type of the column, most explain themselves, a link
column is a relationship. column is a relationship.
constraints: constraints:

View File

@ -1,4 +1,3 @@
import { faker } from "@faker-js/faker"
import { import {
generateMakeRequest, generateMakeRequest,
MakeRequestResponse, MakeRequestResponse,
@ -14,19 +13,24 @@ import {
Table, Table,
} from "@budibase/types" } from "@budibase/types"
import _ from "lodash" import _ from "lodash"
import { generator } from "@budibase/backend-core/tests"
import { utils } from "@budibase/backend-core"
const config = setup.getConfig()! const config = setup.getConfig()!
jest.unmock("node-fetch") jest.unmock("node-fetch")
// TODO: Waiting for the test image to exist // TODO: Waiting for the test image to exist
describe.skip("row api - postgres", () => { describe("row api - postgres", () => {
let apiKey, let apiKey,
makeRequest: MakeRequestResponse, makeRequest: MakeRequestResponse,
postgresDatasource: Datasource, postgresDatasource: Datasource,
postgresTable: Table, postgresTable: Table,
auxPostgresTable: Table auxPostgresTable: Table
const host = generator.ip()
const port = generator.natural()
beforeEach(async () => { beforeEach(async () => {
await config.init() await config.init()
apiKey = await config.generateApiKey() apiKey = await config.generateApiKey()
@ -36,8 +40,8 @@ describe.skip("row api - postgres", () => {
source: SourceName.POSTGRES, source: SourceName.POSTGRES,
plus: true, plus: true,
config: { config: {
host: "192.168.1.98", host,
port: 54321, port,
database: "postgres", database: "postgres",
user: "root", user: "root",
password: "root", password: "root",
@ -52,7 +56,7 @@ describe.skip("row api - postgres", () => {
makeRequest = generateMakeRequest(apiKey, true) makeRequest = generateMakeRequest(apiKey, true)
postgresTable = await config.createTable({ postgresTable = await config.createTable({
name: faker.lorem.word(), name: generator.word(),
schema: { schema: {
name: { name: {
name: "name", name: "name",
@ -74,7 +78,7 @@ describe.skip("row api - postgres", () => {
}) })
auxPostgresTable = await config.createTable({ auxPostgresTable = await config.createTable({
name: faker.lorem.word(), name: generator.word(),
schema: { schema: {
title: { title: {
name: "title", name: "title",
@ -105,9 +109,9 @@ describe.skip("row api - postgres", () => {
function createRandomRow() { function createRandomRow() {
return { return {
name: faker.name.fullName(), name: generator.name(),
description: faker.lorem.paragraphs(), description: generator.paragraph(),
value: +faker.random.numeric(), value: generator.integer(),
} }
} }
@ -150,9 +154,9 @@ describe.skip("row api - postgres", () => {
config: { config: {
ca: false, ca: false,
database: "postgres", database: "postgres",
host: "192.168.1.98", host,
password: "root", password: "--secret-value--",
port: 54321, port,
rejectUnauthorized: false, rejectUnauthorized: false,
schema: "public", schema: "public",
ssl: false, ssl: false,
@ -213,8 +217,8 @@ describe.skip("row api - postgres", () => {
test("Given than a row exists, updating it persists it", async () => { test("Given than a row exists, updating it persists it", async () => {
let { row } = _.sample(await populateRows(10))! let { row } = _.sample(await populateRows(10))!
const newName = faker.random.words(3) const newName = generator.name()
const newValue = +faker.random.numeric() const newValue = generator.integer()
const updatedRow = { const updatedRow = {
...row, ...row,
name: newName, name: newName,
@ -311,7 +315,7 @@ describe.skip("row api - postgres", () => {
const foreignRow = await config.createRow({ const foreignRow = await config.createRow({
tableId: auxPostgresTable._id, tableId: auxPostgresTable._id,
title: faker.random.alphaNumeric(10), title: generator.sentence(),
linkedField: row._id, linkedField: row._id,
}) })
@ -376,17 +380,17 @@ describe.skip("row api - postgres", () => {
}) })
test("Querying by a string field returns the rows with field containing or starting by that value", async () => { test("Querying by a string field returns the rows with field containing or starting by that value", async () => {
const name = faker.name.fullName() const name = generator.name()
const rowsToFilter = [ const rowsToFilter = [
...Array(2).fill({ ...Array(2).fill({
name, name,
description: faker.lorem.paragraphs(), description: generator.paragraph(),
value: +faker.random.numeric(), value: generator.integer(),
}), }),
...Array(2).fill({ ...Array(2).fill({
name: `${name}${faker.random.alphaNumeric(5)}`, name: `${name}${utils.newid()}`,
description: faker.lorem.paragraphs(), description: generator.paragraph(),
value: +faker.random.numeric(), value: generator.integer(),
}), }),
] ]
@ -525,7 +529,7 @@ describe.skip("row api - postgres", () => {
const foreignRow = await config.createRow({ const foreignRow = await config.createRow({
tableId: auxPostgresTable._id, tableId: auxPostgresTable._id,
title: faker.random.alphaNumeric(10), title: generator.name(),
linkedField: row._id, linkedField: row._id,
}) })