diff --git a/test/test.ts b/test/test.ts index eee2f0c..adbbd1e 100644 --- a/test/test.ts +++ b/test/test.ts @@ -4,7 +4,7 @@ import * as smartmongo from '../ts/index'; let smartmongoInstance: smartmongo.SmartMongo; tap.test('should create a mongo instance', async () => { - smartmongoInstance = await smartmongo.SmartMongo.createInstance(); + smartmongoInstance = await smartmongo.SmartMongo.createAndInit(); }); tap.test('should stop the instance', async () => { diff --git a/ts/index.ts b/ts/index.ts index 5e790ca..883ef3b 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -2,9 +2,9 @@ import * as plugins from './smartmongo.plugins'; export class SmartMongo { // STATIC - public static async createInstance() { + public static async createAndInit() { const smartMongoInstance = new SmartMongo(); - await smartMongoInstance.readyPromise; + await smartMongoInstance.init(); return smartMongoInstance; } @@ -14,7 +14,6 @@ export class SmartMongo { public mongod: plugins.mongoPlugin.MongoMemoryServer; constructor() { - this.init(); } public async init() {