From ca8b05631a33c39e06c7c3917cbfb02d8dcbc6e2 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 9 Nov 2020 09:21:05 +0000 Subject: [PATCH] Tools: Fixed tests --- packages/app-cli/tests/test-utils.js | 1 + packages/lib/services/KvStore.ts | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app-cli/tests/test-utils.js b/packages/app-cli/tests/test-utils.js index c5c41a400..f0aac058e 100644 --- a/packages/app-cli/tests/test-utils.js +++ b/packages/app-cli/tests/test-utils.js @@ -508,6 +508,7 @@ async function expectNotThrow(asyncFn) { } if (thrownError) { + console.error(thrownError); expect(thrownError.message).toBe('', 'Expected function not to throw an error but it did'); } else { expect(true).toBe(true); diff --git a/packages/lib/services/KvStore.ts b/packages/lib/services/KvStore.ts index b5e9ff2aa..a1d1ebf10 100644 --- a/packages/lib/services/KvStore.ts +++ b/packages/lib/services/KvStore.ts @@ -92,8 +92,7 @@ export default class KvStore extends BaseService { try { const result = await this.db().selectOne('SELECT `value`, `type` FROM key_values WHERE `key` = ?', [key]); - const value = this.formatValue_(result.value, result.type) as ValueType.Int; - const newValue = result ? value + inc : inc; + const newValue = result ? (this.formatValue_(result.value, result.type) as ValueType.Int) + inc : inc; await this.setValue(key, newValue); release(); return newValue;