Skip to content

Commit

Permalink
refactor(indiekit): don’t return false from mongo config
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Dec 24, 2023
1 parent fa84279 commit 1931bc6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion packages/indiekit/lib/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const getMongodbConfig = async (mongodbUrl) => {
return database;
} catch (error) {
console.warn(error.message);
return false;
}
}
};
3 changes: 1 addition & 2 deletions packages/indiekit/tests/unit/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ test("Connects to MongoDB database", async (t) => {

test("Returns false if can’t connect to a MongoDB database", async (t) => {
sinon.stub(console, "warn");
const result = await getMongodbConfig("https://foo.bar");
await getMongodbConfig("https://foo.bar");

t.true(
console.warn.calledWith(
'Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"',
),
);
t.false(result);
});

0 comments on commit 1931bc6

Please sign in to comment.