Skip to content

Commit 60858b1

Browse files
committed
style(MongoInstance): rename interface to have an better name
1 parent 7efb4ff commit 60858b1

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

packages/mongodb-memory-server-core/src/MongoMemoryReplSet.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import debug from 'debug';
1515
import { MongoClient, MongoError } from 'mongodb';
1616
import {
1717
MongoInstanceEvents,
18-
MongoMemoryInstanceProp,
18+
MongoMemoryInstanceOpts,
1919
MongoMemoryInstanceOptsBase,
2020
StorageEngine,
2121
} from './util/MongoInstance';
@@ -253,8 +253,8 @@ export class MongoMemoryReplSet extends EventEmitter {
253253
* Returns instance options suitable for a MongoMemoryServer.
254254
* @param baseOpts Options to merge with
255255
*/
256-
protected getInstanceOpts(baseOpts: MongoMemoryInstanceOptsBase = {}): MongoMemoryInstanceProp {
257-
const opts: MongoMemoryInstanceProp = {
256+
protected getInstanceOpts(baseOpts: MongoMemoryInstanceOptsBase = {}): MongoMemoryInstanceOpts {
257+
const opts: MongoMemoryInstanceOpts = {
258258
// disable "auth" if replsetopts has an object-auth
259259
auth:
260260
typeof this._replSetOpts.auth === 'object' && !this._ranCreateAuth
@@ -576,7 +576,7 @@ export class MongoMemoryReplSet extends EventEmitter {
576576
* Create the one Instance (without starting them)
577577
* @param instanceOpts Instance Options to use for this instance
578578
*/
579-
protected _initServer(instanceOpts: MongoMemoryInstanceProp): MongoMemoryServer {
579+
protected _initServer(instanceOpts: MongoMemoryInstanceOpts): MongoMemoryServer {
580580
const serverOpts: MongoMemoryServerOpts = {
581581
binary: this._binaryOpts,
582582
instance: instanceOpts,

packages/mongodb-memory-server-core/src/MongoMemoryServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from './util/utils';
1212
import MongoInstance, {
1313
MongodOpts,
14-
MongoMemoryInstanceProp,
14+
MongoMemoryInstanceOpts,
1515
StorageEngine,
1616
} from './util/MongoInstance';
1717
import { MongoBinaryOpts } from './util/MongoBinary';
@@ -29,7 +29,7 @@ tmp.setGracefulCleanup();
2929
* MongoMemoryServer Stored Options
3030
*/
3131
export interface MongoMemoryServerOpts {
32-
instance?: MongoMemoryInstanceProp;
32+
instance?: MongoMemoryInstanceOpts;
3333
binary?: MongoBinaryOpts;
3434
spawn?: SpawnOptions;
3535
/**

packages/mongodb-memory-server-core/src/__tests__/replset-single.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import MongoMemoryReplSet, {
66
import { MongoClient } from 'mongodb';
77
import MongoMemoryServer from '../MongoMemoryServer';
88
import * as utils from '../util/utils';
9-
import { MongoMemoryInstanceProp } from '../util/MongoInstance';
9+
import { MongoMemoryInstanceOpts } from '../util/MongoInstance';
1010

1111
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
1212

@@ -427,7 +427,7 @@ describe('MongoMemoryReplSet', () => {
427427
expect(
428428
// @ts-expect-error because "getInstanceOpts" is protected
429429
replSet.getInstanceOpts({ storageEngine: 'wiredTiger' })
430-
).toMatchObject<MongoMemoryInstanceProp>({
430+
).toMatchObject<MongoMemoryInstanceOpts>({
431431
// this is needed, otherwise no ts error when "storageEngine" might get changed
432432
storageEngine: 'wiredTiger',
433433
});

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ export interface MongoMemoryInstanceOptsBase {
2424
storageEngine?: StorageEngine;
2525
}
2626

27-
// TODO: find an better name for this interface
28-
// TODO: find a way to unify with "MongoInstanceOpts"
29-
export interface MongoMemoryInstanceProp extends MongoMemoryInstanceOptsBase {
27+
export interface MongoMemoryInstanceOpts extends MongoMemoryInstanceOptsBase {
3028
auth?: boolean;
3129
dbName?: string;
3230
ip?: string; // for binding to all IP addresses set it to `::,0.0.0.0`, by default '127.0.0.1'
@@ -52,7 +50,7 @@ export enum MongoInstanceEvents {
5250

5351
export interface MongodOpts {
5452
// instance options
55-
instance: MongoMemoryInstanceProp;
53+
instance: MongoMemoryInstanceOpts;
5654

5755
// mongo binary options
5856
binary: MongoBinaryOpts;
@@ -75,7 +73,7 @@ export interface MongoInstance extends EventEmitter {
7573
export class MongoInstance extends EventEmitter {
7674
// Mark these values as "readonly" & "Readonly" because modifying them after starting will have no effect
7775
// readonly is required otherwise the property can still be changed on the root level
78-
instanceOpts: MongoMemoryInstanceProp;
76+
instanceOpts: MongoMemoryInstanceOpts;
7977
readonly binaryOpts: Readonly<MongoBinaryOpts>;
8078
readonly spawnOpts: Readonly<SpawnOptions>;
8179

0 commit comments

Comments
 (0)