Skip to content

Commit

Permalink
Codebase cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardBoyewa committed Aug 8, 2023
1 parent f01a69c commit e026b29
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test.*
dist/.mongot
dist/.Mongohat
dist/.Mongohat_*
node_modules
6 changes: 3 additions & 3 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Collection, MongoClient } from "mongodb";
import { MongoMemoryServer, MongoMemoryReplSet } from "mongodb-memory-server";
export interface MongohatOption {
dbName: string;
dbPath: string;
dbName?: string;
dbPath?: string;
dbPort?: number;
useReplicaSet?: boolean;
version?: string;
Expand Down Expand Up @@ -33,7 +33,7 @@ export declare class Mongohat {
refresh(): Promise<import("mongodb").InsertManyResult<import("bson").Document>[]>;
clean(data?: {}): Promise<(boolean | void)[]>;
drop(): Promise<boolean>;
private dropDB;
dropDB(): Promise<(boolean | void)[]>;
private delay;
getDBUrl(): string;
stop(): Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Mongohat {
this.dataDir = "/.Mongohat";
this.defaultPort = 27777;
this.context = contextName;
this.defaultTempDir = `${__dirname}${this.dataDir}`;
this.defaultTempDir = `${__dirname}${this.dataDir}_${contextName}`;
this.config = {
dbName: this.context && this.context.trim().length > 0
? this.context
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import * as Debug from "debug";
import * as portfinder from "portfinder";

export interface MongohatOption {
dbName: string;
dbPath: string;
dbName?: string;
dbPath?: string;
dbPort?: number;
useReplicaSet?: boolean;
version?: string;
Expand Down Expand Up @@ -42,7 +42,7 @@ export class Mongohat {
*/
constructor(contextName: string, option?: MongohatOption) {
this.context = contextName;
this.defaultTempDir = `${__dirname}${this.dataDir}`;
this.defaultTempDir = `${__dirname}${this.dataDir}_${contextName}`;
this.config = {
dbName:
this.context && this.context.trim().length > 0
Expand Down Expand Up @@ -229,7 +229,7 @@ export class Mongohat {
return this.client.db(this.config.dbName).dropDatabase();
}

private async dropDB() {
public async dropDB() {
this.testData = {};
const db = this.client.db(this.config.dbName);
return db.collections().then((collections) => {
Expand Down

0 comments on commit e026b29

Please sign in to comment.