Skip to content

Commit

Permalink
chore(e2e): use env dbName instead of url
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-wayner committed Jan 18, 2024
1 parent 3ef2de1 commit 0324ced
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/lib/e2e/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ export default async () => {
const url = process.env.inxtbridge_storage__mongoUrl;
const user = process.env.inxtbridge_storage__mongoOpts__user;
const password = process.env.inxtbridge_storage__mongoOpts__pass;
const dbName = process.env.inxtbridge_storage__mongoOpts__dbName;
if (!url) throw new Error('Missing mongo url');
if (!user) throw new Error('Missing mongo user');
if (!password) throw new Error('Missing mongo password');
if (!dbName) throw new Error('Missing mongo dbName');

if (!url.includes('test')) {
if (!url.includes('test') || !dbName.includes('test')) {
throw new Error("For caution test database must include test in it's name");
}

const urlParts = url.split('/');
const dbName = urlParts.pop();
const client = new MongoClient(urlParts.join('/'));
const client = new MongoClient(url);

await client.connect();

Expand Down

0 comments on commit 0324ced

Please sign in to comment.