Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from ericsandine/develop
Allow SRV mongo Urls
- Loading branch information
Showing
3 changed files
with
30 additions
and
5 deletions.
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,5 @@ | ||
"use strict"; | ||
|
||
module.exports = (url) => { | ||
return url.split(":")[0].includes("srv"); | ||
}; |
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,16 @@ | ||
"use strict"; | ||
|
||
const test = require("ava"); | ||
|
||
const isSrvUrl = require("../../src/utils/isSrvUrl"); | ||
const standarConnectionString = "mongodb://localhost:27017/ackee"; | ||
const srvConnectionString = | ||
"mongodb+srv://username:badpw@cluster0-OMITTED.mongodb.net/ackee"; | ||
|
||
test("return standard connection string is false", async (t) => { | ||
t.is(isSrvUrl(standarConnectionString), false); | ||
}); | ||
|
||
test("return srv connection string is false", async (t) => { | ||
t.is(isSrvUrl(srvConnectionString), true); | ||
}); |