Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: serialize item of type array with zero #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrysomallos
Copy link

@chrysomallos chrysomallos commented May 30, 2024

Currently the serialize in dynamodb will return [null, null] instead of [0, 0].
Issue found in a not correct check at lib/serializer.js:142, the values 0 and '' are result as null, because they are truish at this check.
Result of new test case without the changes on lib/serializer.js to see the issue:

Serializer
       #serializeItem
         should serialize number array with zeros:

      AssertionError: expected { id: 1, resolution: [ null, null ] } to deeply equal { id: 1, resolution: [ +0, +0 ] }
      + expected - actual

       {
         "id": 1
         "resolution": [
      -    [null]
      -    [null]
      +    0
      +    0
         ]
       }

      at Context.<anonymous> (test\serializer-test.js:543:19)
      at process.processImmediate (node:internal/timers:476:21)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant