fix(core): update

This commit is contained in:
Philipp Kunz 2021-12-20 16:58:17 +01:00
parent f6e4bfd17e
commit bf31318a95
2 changed files with 3 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import * as smartmongo from '../ts/index';
let smartmongoInstance: smartmongo.SmartMongo; let smartmongoInstance: smartmongo.SmartMongo;
tap.test('should create a mongo instance', async () => { 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 () => { tap.test('should stop the instance', async () => {

View File

@ -2,9 +2,9 @@ import * as plugins from './smartmongo.plugins';
export class SmartMongo { export class SmartMongo {
// STATIC // STATIC
public static async createInstance() { public static async createAndInit() {
const smartMongoInstance = new SmartMongo(); const smartMongoInstance = new SmartMongo();
await smartMongoInstance.readyPromise; await smartMongoInstance.init();
return smartMongoInstance; return smartMongoInstance;
} }
@ -14,7 +14,6 @@ export class SmartMongo {
public mongod: plugins.mongoPlugin.MongoMemoryServer; public mongod: plugins.mongoPlugin.MongoMemoryServer;
constructor() { constructor() {
this.init();
} }
public async init() { public async init() {