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;