From fbdde2268c965161c2dd0c53899f750a3555187d Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 19 Oct 2020 16:44:28 +0000 Subject: [PATCH] fix(core): update --- package.json | 2 +- test/test.ts | 8 +++----- ts/smartdata.classes.collectionfactory.ts | 11 +++++++---- ts/smartdata.classes.db.ts | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 006af8c..d0c5015 100644 --- a/package.json +++ b/package.json @@ -60,4 +60,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index ba9d93d..e554bb8 100644 --- a/test/test.ts +++ b/test/test.ts @@ -68,7 +68,7 @@ class Car extends smartdata.SmartDataDbDoc { @smartdata.svDb() deepData = { - sodeep: 'yes' + sodeep: 'yes', }; constructor(colorArg: string, brandArg: string) { @@ -85,15 +85,13 @@ tap.test('should save the car to the db', async () => { const myCar2 = new Car('red', 'Volvo'); await myCar2.save(); - - let counter = 0; const totalCars = 2000; do { const myCar3 = new Car('red', 'Renault'); await myCar3.save(); counter++; - if (counter%100 === 0) { + if (counter % 100 === 0) { console.log(`Filled database with ${counter} of ${totalCars} Cars`); } } while (counter < totalCars); @@ -139,7 +137,7 @@ tap.test('expect to get instance of Car and update it', async () => { tap.test('should be able to delete an instance of car', async () => { const myCars = await Car.getInstances({ brand: 'Volvo', - color: 'blue' + color: 'blue', }); console.log(myCars); expect(myCars[0].color).to.equal('blue'); diff --git a/ts/smartdata.classes.collectionfactory.ts b/ts/smartdata.classes.collectionfactory.ts index 5982223..2046b14 100644 --- a/ts/smartdata.classes.collectionfactory.ts +++ b/ts/smartdata.classes.collectionfactory.ts @@ -3,9 +3,12 @@ import { SmartdataCollection } from './smartdata.classes.collection'; import { SmartdataDb } from './smartdata.classes.db'; export class CollectionFactory { - public collections: {[key: string]: SmartdataCollection} = {}; + public collections: { [key: string]: SmartdataCollection } = {}; - public getCollection = (nameArg: string, dbArg: SmartdataDb | (() => SmartdataDb)): SmartdataCollection => { + public getCollection = ( + nameArg: string, + dbArg: SmartdataDb | (() => SmartdataDb) + ): SmartdataCollection => { if (!this.collections[nameArg]) { this.collections[nameArg] = (() => { if (dbArg instanceof SmartdataDb) { @@ -18,5 +21,5 @@ export class CollectionFactory { })(); } return this.collections[nameArg]; - } -} \ No newline at end of file + }; +} diff --git a/ts/smartdata.classes.db.ts b/ts/smartdata.classes.db.ts index f857312..ccf3f4f 100644 --- a/ts/smartdata.classes.db.ts +++ b/ts/smartdata.classes.db.ts @@ -43,7 +43,7 @@ export class SmartdataDb { useNewUrlParser: true, useUnifiedTopology: true, maxPoolSize: 100, - maxIdleTimeMS: 10 + maxIdleTimeMS: 10, }); this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName); this.status = 'connected';