forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly override database url properties (typeorm#6247)
* fix: properly override database url properties Closes typeorm#4878 * test: add test for overriding url options
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DriverUtils } from "../../../src/driver/DriverUtils"; | ||
import { expect } from "chai"; | ||
|
||
describe("github issues > #4878 URL Connection string not overridden by supplied options", () => { | ||
it("should override url-built options with user-supplied options", () => { | ||
const obj: any = { | ||
username: "user", | ||
password: "password", | ||
host: "host", | ||
database: "database", | ||
port: 8888 | ||
}; | ||
|
||
const url = `postgres://url_user:${obj.password}@${obj.host}:${obj.port}/${obj.database}`; | ||
obj.url = url; | ||
const options = DriverUtils.buildDriverOptions(obj); | ||
expect(options.username).to.eql(obj.username); | ||
}); | ||
}); |