Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

fix(voice): Force NCCO actions to set value for NCCO type to avoid JS problems #853

Closed dragonmantank closed 10 months ago

dragonmantank commented 10 months ago

Description

When serializing an NCCO to a JS object, set the action to a static value instead of relying on the object's this.action property.

Motivation and Context

When making the JS Object serializations, using action: this.action to generate the resulting objects would always result in a blank value. This seems to work fine on some versions of node, for the unit tests, and in TS, but when running in a pure JS environment the resulting value was blank. Since NCCOs have a static action value based on their type, this just sets the value directly during deserialization.

Testing Details

Unit tests, as well as manual testing to help build the patch.

Example Output or Screenshots (if appropriate)

Types of changes

Checklist

codecov-commenter commented 10 months ago

Codecov Report

Merging #853 (d98c7f6) into 3.x (f04c595) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##              3.x     #853   +/-   ##
=======================================
  Coverage   83.42%   83.42%           
=======================================
  Files         119      119           
  Lines        1484     1484           
  Branches      283      283           
=======================================
  Hits         1238     1238           
  Misses        245      245           
  Partials        1        1           
Files Changed Coverage Δ
packages/voice/lib/classes/NCCO/Connect.ts 0.00% <ø> (ø)
packages/voice/lib/classes/NCCO/Conversation.ts 61.76% <ø> (ø)
packages/voice/lib/classes/NCCO/Record.ts 0.00% <ø> (ø)
packages/voice/lib/classes/NCCO/Stream.ts 0.00% <ø> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more