Fix tests.
This commit is contained in:
parent
85c372c4d6
commit
d2c273542d
|
@ -4,13 +4,14 @@ import {
|
||||||
MakeRequestResponse,
|
MakeRequestResponse,
|
||||||
} from "../api/routes/public/tests/utils"
|
} from "../api/routes/public/tests/utils"
|
||||||
import * as setup from "../api/routes/tests/utilities"
|
import * as setup from "../api/routes/tests/utilities"
|
||||||
import { Datasource, FieldType, Table, TableSourceType } from "@budibase/types"
|
import { Datasource, FieldType } from "@budibase/types"
|
||||||
import {
|
import {
|
||||||
DatabaseName,
|
DatabaseName,
|
||||||
getDatasource,
|
getDatasource,
|
||||||
rawQuery,
|
rawQuery,
|
||||||
} from "../integrations/tests/utils"
|
} from "../integrations/tests/utils"
|
||||||
import { generator } from "@budibase/backend-core/tests"
|
import { generator } from "@budibase/backend-core/tests"
|
||||||
|
import { tableForDatasource } from "../../src/tests/utilities/structures"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
fetch.mockSearch()
|
fetch.mockSearch()
|
||||||
|
|
||||||
|
@ -41,8 +42,7 @@ jest.mock("../websockets", () => ({
|
||||||
describe("mysql integrations", () => {
|
describe("mysql integrations", () => {
|
||||||
let makeRequest: MakeRequestResponse,
|
let makeRequest: MakeRequestResponse,
|
||||||
rawDatasource: Datasource,
|
rawDatasource: Datasource,
|
||||||
datasource: Datasource,
|
datasource: Datasource
|
||||||
primaryMySqlTable: Table
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
@ -54,38 +54,12 @@ describe("mysql integrations", () => {
|
||||||
datasource = await config.api.datasource.create(rawDatasource)
|
datasource = await config.api.datasource.create(rawDatasource)
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
primaryMySqlTable = await config.createTable({
|
|
||||||
name: uniqueTableName(),
|
|
||||||
type: "table",
|
|
||||||
primary: ["id"],
|
|
||||||
schema: {
|
|
||||||
id: {
|
|
||||||
name: "id",
|
|
||||||
type: FieldType.AUTO,
|
|
||||||
autocolumn: true,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
name: "name",
|
|
||||||
type: FieldType.STRING,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
name: "description",
|
|
||||||
type: FieldType.STRING,
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
name: "value",
|
|
||||||
type: FieldType.NUMBER,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sourceId: datasource._id,
|
|
||||||
sourceType: TableSourceType.EXTERNAL,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
afterAll(config.end)
|
afterAll(config.end)
|
||||||
|
|
||||||
it("validate table schema", async () => {
|
it("validate table schema", async () => {
|
||||||
|
// Creating a table so that `entities` is populated.
|
||||||
|
await config.api.table.save(tableForDatasource(datasource))
|
||||||
|
|
||||||
const res = await makeRequest("get", `/api/datasources/${datasource._id}`)
|
const res = await makeRequest("get", `/api/datasources/${datasource._id}`)
|
||||||
|
|
||||||
expect(res.status).toBe(200)
|
expect(res.status).toBe(200)
|
||||||
|
|
Loading…
Reference in New Issue