Fix tests asserts

This commit is contained in:
Adria Navarro 2023-05-17 10:14:13 +02:00
parent d2877fff6e
commit ed8550b271
3 changed files with 17 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import { GenericContainer } from "testcontainers" import { GenericContainer } from "testcontainers"
import { generator } from "@budibase/backend-core/tests"
import couchdb from "../../../../packages/server/src/integrations/couchdb" import couchdb from "../../../../packages/server/src/integrations/couchdb"
import { generator } from "../../shared"
describe("datasource validators", () => { describe("datasource validators", () => {
describe("couchdb", () => { describe("couchdb", () => {
@ -46,7 +46,9 @@ describe("datasource validators", () => {
database: "random_db", database: "random_db",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(false) expect(result).toEqual({
connected: false,
})
}) })
it("test invalid url", async () => { it("test invalid url", async () => {

View File

@ -61,7 +61,10 @@ describe("datasource validators", () => {
tlsCAFile: "", tlsCAFile: "",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ error: "Authentication failed." }) expect(result).toEqual({
connected: false,
error: "Authentication failed.",
})
}) })
it("test invalid username", async () => { it("test invalid username", async () => {
@ -73,7 +76,10 @@ describe("datasource validators", () => {
tlsCAFile: "", tlsCAFile: "",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ error: "Authentication failed." }) expect(result).toEqual({
connected: false,
error: "Authentication failed.",
})
}) })
it("test invalid connection", async () => { it("test invalid connection", async () => {
@ -85,7 +91,10 @@ describe("datasource validators", () => {
tlsCAFile: "", tlsCAFile: "",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ error: "Error: getaddrinfo ENOTFOUND http" }) expect(result).toEqual({
connected: false,
error: "Error: getaddrinfo ENOTFOUND http",
})
}) })
}) })
}) })

View File

@ -36,6 +36,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: error:
"WRONGPASS invalid username-password pair or user is disabled.", "WRONGPASS invalid username-password pair or user is disabled.",
}) })