diff --git a/scripts/tests.ts b/scripts/tests.ts index 5e6a726..76028fb 100644 --- a/scripts/tests.ts +++ b/scripts/tests.ts @@ -21,11 +21,9 @@ const ping = async () => { }; try { - const res = await DDBClient.instance.send(new ListTablesCommand({})); - - console.log({ res }); + await DDBClient.instance.send(new ListTablesCommand({})); } catch (error) { - console.log({ error }); + console.error({ error }); return false; } diff --git a/src/expression.ts b/src/expression.ts index 833e7de..4f97725 100644 --- a/src/expression.ts +++ b/src/expression.ts @@ -64,10 +64,6 @@ export const expressionAttributeValues = < for (const key of keys) { const value = options[key]; - if (value === undefined) { - continue; - } - if (!isDuenamoExpression(value)) { result[expressionAttributeValueKey(key)] = value; @@ -116,10 +112,6 @@ export const conditionExpression = < for (const key of keys) { const value = options[key]; - if (!value) { - continue; - } - const nameKey = expressionAttributeNameKey(key); const valueKey = expressionAttributeValueKey(key); diff --git a/test/expression.test.ts b/test/expression.test.ts index ff95c40..109031d 100644 --- a/test/expression.test.ts +++ b/test/expression.test.ts @@ -120,3 +120,22 @@ test('Condition-Expression handles duenamo expression IN', t => { t.is(exp, '#foo IN (:foo_0, :foo_1, :foo_2, :foo_3)'); }); + +test('Condition-Expression handles equal expression and duenamo expression', t => { + const exp = conditionExpression({ + id: NOT('1'), + name: 'username', + foo: IN('bar', 'baz'), + }); + + t.is(exp, '#id <> :id and #name = :name and #foo IN (:foo_0, :foo_1)'); +}); + +test('Condition-Expression handles booleans', t => { + const exp = conditionExpression({ + disabled: false, + name: 'username', + }); + + t.is(exp, '#disabled = :disabled and #name = :name'); +});