1
0
Fork 0
mirror of synced 2024-07-06 15:00:49 +12:00

Update tests to check new formats

This commit is contained in:
Adria Navarro 2023-05-17 09:57:43 +02:00
parent 70b809e4f7
commit d2877fff6e
9 changed files with 19 additions and 10 deletions

View file

@ -41,7 +41,7 @@ describe("datasource validators", () => {
collection: "", collection: "",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test wrong password", async () => { it("test wrong password", async () => {
@ -54,6 +54,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: "not authorized to execute this request", error: "not authorized to execute this request",
}) })
}) })
@ -68,6 +69,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: "getaddrinfo ENOTFOUND not.here", error: "getaddrinfo ENOTFOUND not.here",
}) })
}) })

View file

@ -37,7 +37,7 @@ describe("datasource validators", () => {
database: "db", database: "db",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test invalid database", async () => { it("test invalid database", async () => {
@ -56,6 +56,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: error:
"request to http://invalid:123/any failed, reason: getaddrinfo ENOTFOUND invalid", "request to http://invalid:123/any failed, reason: getaddrinfo ENOTFOUND invalid",
}) })

View file

@ -41,7 +41,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test wrong endpoint", async () => { it("test wrong endpoint", async () => {
@ -54,6 +54,7 @@ describe("datasource validators", () => {
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: error:
"Inaccessible host: `wrong.url' at port `undefined'. This service may not be available in the `eu-west-1' region.", "Inaccessible host: `wrong.url' at port `undefined'. This service may not be available in the `eu-west-1' region.",
}) })

View file

@ -49,7 +49,7 @@ describe("datasource validators", () => {
tlsCAFile: "", tlsCAFile: "",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test invalid password", async () => { it("test invalid password", async () => {

View file

@ -43,7 +43,7 @@ describe("datasource validators", () => {
schema: "dbo", schema: "dbo",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test invalid password", async () => { it("test invalid password", async () => {
@ -57,6 +57,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: "ConnectionError: Login failed for user 'sa'.", error: "ConnectionError: Login failed for user 'sa'.",
}) })
}) })

View file

@ -31,7 +31,7 @@ describe("datasource validators", () => {
rejectUnauthorized: true, rejectUnauthorized: true,
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test invalid database", async () => { it("test invalid database", async () => {
@ -45,6 +45,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: "Access denied for user 'user'@'%' to database 'test'", error: "Access denied for user 'user'@'%' to database 'test'",
}) })
}) })
@ -60,6 +61,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: error:
"Access denied for user 'root'@'172.17.0.1' (using password: YES)", "Access denied for user 'root'@'172.17.0.1' (using password: YES)",
}) })

View file

@ -30,7 +30,7 @@ describe("datasource validators", () => {
rejectUnauthorized: false, rejectUnauthorized: false,
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test invalid connection string", async () => { it("test invalid connection string", async () => {
@ -46,6 +46,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: 'password authentication failed for user "wrong"', error: 'password authentication failed for user "wrong"',
}) })
}) })

View file

@ -24,7 +24,7 @@ describe("datasource validators", () => {
username: "", username: "",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test invalid connection even with wrong user/password", async () => { it("test invalid connection even with wrong user/password", async () => {
@ -64,7 +64,7 @@ describe("datasource validators", () => {
password: "P@ssW0rd!", password: "P@ssW0rd!",
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
}) })
}) })

View file

@ -30,7 +30,7 @@ describe("datasource validators", () => {
endpoint: `http://${host}:${port}`, endpoint: `http://${host}:${port}`,
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toBe(true) expect(result).toEqual({ connected: true })
}) })
it("test wrong endpoint", async () => { it("test wrong endpoint", async () => {
@ -43,6 +43,7 @@ describe("datasource validators", () => {
}) })
const result = await integration.testConnection() const result = await integration.testConnection()
expect(result).toEqual({ expect(result).toEqual({
connected: false,
error: error:
"Inaccessible host: `wrong' at port `undefined'. This service may not be available in the `eu-west-2' region.", "Inaccessible host: `wrong' at port `undefined'. This service may not be available in the `eu-west-2' region.",
}) })