Skip to content

Commit

Permalink
feat(MongoMemoryReplSet): remove function "getDbName"
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove function "getDbName", replace with ".opts.replSet.dbName"
  • Loading branch information
hasezoey committed Oct 12, 2020
1 parent 65135a8 commit 6ebafbd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
7 changes: 0 additions & 7 deletions packages/mongodb-memory-server-core/src/MongoMemoryReplSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ export class MongoMemoryReplSet extends EventEmitter {
return this._state;
}

/**
* Returns database name.
*/
getDbName(): string {
return this.opts.replSet.dbName;
}

/**
* Returns instance options suitable for a MongoMemoryServer.
* @param baseOpts Options to merge with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('multi-member replica set', () => {
// await while all SECONDARIES will be ready
await new Promise((resolve) => setTimeout(resolve, 2000));

const db = await con.db(replSet.getDbName());
const db = await con.db(replSet.opts.replSet.dbName);
const admin = db.admin();
const status = await admin.replSetGetStatus();
expect(status.members.filter((m: any) => m.stateStr === 'PRIMARY')).toHaveLength(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ describe('single server replset', () => {

it('should be able to get dbName', async () => {
const replSet = new MongoMemoryReplSet({ replSet: { dbName: 'static' } });
const dbName = replSet.getDbName();
expect(dbName).toEqual('static');
expect(replSet.opts.replSet.dbName).toEqual('static');

await replSet.stop();
});
Expand Down

0 comments on commit 6ebafbd

Please sign in to comment.