Fix tests.
This commit is contained in:
parent
85c372c4d6
commit
d2c273542d
|
@ -4,13 +4,14 @@ import {
|
|||
MakeRequestResponse,
|
||||
} from "../api/routes/public/tests/utils"
|
||||
import * as setup from "../api/routes/tests/utilities"
|
||||
import { Datasource, FieldType, Table, TableSourceType } from "@budibase/types"
|
||||
import { Datasource, FieldType } from "@budibase/types"
|
||||
import {
|
||||
DatabaseName,
|
||||
getDatasource,
|
||||
rawQuery,
|
||||
} from "../integrations/tests/utils"
|
||||
import { generator } from "@budibase/backend-core/tests"
|
||||
import { tableForDatasource } from "../../src/tests/utilities/structures"
|
||||
// @ts-ignore
|
||||
fetch.mockSearch()
|
||||
|
||||
|
@ -41,8 +42,7 @@ jest.mock("../websockets", () => ({
|
|||
describe("mysql integrations", () => {
|
||||
let makeRequest: MakeRequestResponse,
|
||||
rawDatasource: Datasource,
|
||||
datasource: Datasource,
|
||||
primaryMySqlTable: Table
|
||||
datasource: Datasource
|
||||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
|
@ -54,38 +54,12 @@ describe("mysql integrations", () => {
|
|||
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)
|
||||
|
||||
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}`)
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
|
|
Loading…
Reference in New Issue