mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
test DriverOptionNotSetError is thrown when socketPath or host is missing
This commit is contained in:
parent
be43fa7080
commit
1632754a1c
@ -17,6 +17,7 @@ import {CannotGetEntityManagerNotConnectedError} from "../../../src/connection/e
|
||||
import {Blog} from "./modules/blog/entity/Blog";
|
||||
import {Question} from "./modules/question/entity/Question";
|
||||
import {Video} from "./modules/video/entity/Video";
|
||||
import {ConnectionOptions} from "../../../src/connection/ConnectionOptions";
|
||||
|
||||
describe("Connection", () => {
|
||||
const resourceDir = __dirname + "/../../../../../test/functional/connection/";
|
||||
@ -81,6 +82,39 @@ describe("Connection", () => {
|
||||
|
||||
});
|
||||
|
||||
describe("establishing connection", function() {
|
||||
let connection: Connection;
|
||||
after(() => {
|
||||
if (connection && connection.isConnected)
|
||||
return connection.close();
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
it("should throw DriverOptionNotSetError when extra.socketPath is missing", function() {
|
||||
let didThrow = false;
|
||||
try {
|
||||
connection = getConnectionManager().create(<ConnectionOptions>{
|
||||
driver: {
|
||||
"type": "mysql",
|
||||
"username": "test",
|
||||
"password": "test",
|
||||
"database": "test",
|
||||
},
|
||||
entities: [],
|
||||
entitySchemas: [],
|
||||
dropSchemaOnConnection: false,
|
||||
schemaCreate: false,
|
||||
enabledDrivers: ["mysql"],
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
didThrow = true;
|
||||
}
|
||||
expect(didThrow).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe("after connection is established successfully", function() {
|
||||
|
||||
let connections: Connection[];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user