diff --git a/test/test.ts b/test/test.ts index 8fc1ea4..5e66a0c 100644 --- a/test/test.ts +++ b/test/test.ts @@ -30,4 +30,8 @@ tap.test('should create a valid instance of SmartAcme', async () => { // await smartAcmeInstance.getCertificateForDomain('bleu.de'); }); +tap.test('should stop correctly', async () => { + await smartAcmeInstance.stop(); +}); + tap.start(); diff --git a/ts/smartacme.classes.smartacme.ts b/ts/smartacme.classes.smartacme.ts index 642c5a4..09413d5 100644 --- a/ts/smartacme.classes.smartacme.ts +++ b/ts/smartacme.classes.smartacme.ts @@ -1,4 +1,5 @@ import * as plugins from './smartacme.plugins'; +import { Cert } from './smartacme.classes.cert'; import { CertManager } from './smartacme.classes.certmanager'; import * as interfaces from './interfaces'; @@ -112,9 +113,11 @@ export class SmartAcme { }); } - public async stop() {}; + public async stop() { + await this.certmanager.smartdataDb.close(); + } - public async getCertificateForDomain(domainArg: string) { + public async getCertificateForDomain(domainArg: string): Promise { const domain = domainArg; const retrievedCertificate = await this.certmanager.retrieveCertificate(domain);