Test bad connections

This commit is contained in:
Adria Navarro 2023-05-12 11:23:51 +02:00
parent 901bff5399
commit b8d11fa351
1 changed files with 26 additions and 0 deletions

View File

@ -44,5 +44,31 @@ describe("datasource validators", () => {
})
expect(result).toBe(true)
})
it("test wrong password", async () => {
const result = await validator({
url: connectionSettings.url,
username: connectionSettings.user,
password: "wrong",
databaseName: "",
collection: "",
})
expect(result).toEqual({
error: "not authorized to execute this request",
})
})
it("test wrong url", async () => {
const result = await validator({
url: "http://not.here",
username: connectionSettings.user,
password: connectionSettings.password,
databaseName: "",
collection: "",
})
expect(result).toEqual({
error: "getaddrinfo ENOTFOUND not.here",
})
})
})
})