From e5a02a014a29944015edd61675d62ec5c454415e Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 20 Dec 2021 17:06:42 +0100 Subject: [PATCH] fix(core): update --- test/test.ts | 3 +-- ts/index.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/test.ts b/test/test.ts index d4aa3d9..28ea10b 100644 --- a/test/test.ts +++ b/test/test.ts @@ -6,11 +6,10 @@ import * as smarts3 from '../ts/index'; let testSmarts3Instance: smarts3.Smarts3; tap.test('should create a smarts3 instance and run it', async toolsArg => { - testSmarts3Instance = new smarts3.Smarts3({ + testSmarts3Instance = await smarts3.Smarts3.createAndStart({ port: 3000, cleanSlate: true, }); - await testSmarts3Instance.start(); console.log(`Let the instance run for 2 seconds`); await toolsArg.delayFor(2000); }); diff --git a/ts/index.ts b/ts/index.ts index cb9b34f..8cfbe2f 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -7,6 +7,14 @@ export interface ISmarts3ContructorOptions { } export class Smarts3 { + // STATIC + public static async createAndStart(optionsArg: ConstructorParameters[0]) { + const smartS3Instance = new Smarts3(optionsArg); + await smartS3Instance.start(); + return smartS3Instance; + } + + // INSTANCE public options: ISmarts3ContructorOptions; public dataForClient = { s3AccessKey: 'S3RVER',