Created
July 28, 2021 07:02
-
-
Save kridai/0375a39e64e02bf7b6ecd6637cf9910e to your computer and use it in GitHub Desktop.
twilio-cli-unit-test-28-07-21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm test | |
> twilio-cli@2.24.0 test | |
> nyc --check-coverage --lines 90 --reporter=html --reporter=text mocha --forbid-only "test/**/*.test.js" | |
base-commands | |
twilio-api-command | |
TwilioApiCommand | |
✓ setUpNewCommandClass | |
✓ checks that parameters with inequalities convert to the correct flag names | |
✓ handles remove action | |
✓ creates a call (42ms) | |
✓ lists calls | |
✓ deletes a call | |
✓ updates a call | |
✓ exits with a failure code and prints validation errors (67ms) | |
✓ creates a call with an invalid parameter | |
✓ adds header parameters | |
commands | |
config | |
list | |
✓ runs config:list, should list config variables | |
✓ runs config:list, should prioritize environment if both environment and config edge set | |
✓ runs config:list, should list empty as edge is not set | |
✓ runs config:list, should list config variables as requireProfileInput set | |
✓ runs config:list, should list config variables as requireProfileInput not set | |
✓ runs config:list, should list all config properties in userConfig | |
commands | |
config | |
set | |
✓ runs config:set ,should throw error as there are no configurations/flags provided. (311ms) | |
edge | |
✓ runs config:set --edge=createEdge | |
✓ runs config:set --edge=updateEdge | |
✓ runs config:set --edge=updateEdge with overwrite as false | |
✓ runs config:set --edge=createEdge, will show warning if environment variable exists | |
✓ runs config:set --edge= ,should remove the edge from configuration | |
✓ runs config:set --edge= ,should not remove the edge from configuration | |
✓ runs config:set --edge= ,should throw error as there is no existing edge | |
require-profile-input | |
✓ runs config:set --require-profile-input | |
✓ runs config:set --no-require-profile-input | |
✓ runs config:set --no-require-profile-input with confirmation overwrite as false | |
debugger:logs:list | |
historical | |
✓ prints alert/log events (617ms) | |
✓ prints errors | |
✓ accepts date args | |
✓ prints errors | |
streaming | |
✓ streams and then quits (2024ms) | |
✓ does not like end dates when steaming | |
✓ does not like futuristic start dates | |
commands | |
send | |
✓ run email:send with no environment variable for SendGrid key | |
✓ run email:send without defaults and with multiple recipients including an incorrect to email address | |
✓ run email:send with filled out inquirer prompts | |
✓ run email:send use inquire and a flag to set information | |
✓ run email:send without defaults and an invalid from email address | |
✓ run email:send with default subject line and sending email address | |
✓ run email:send with defaults and multiple recipients | |
✓ run email:send with all flags | |
✓ run email:send with flags and default subject line | |
✓ run email:send using flags to set information using relative file path | |
✓ run email:send using flags to set information using invalid file path | |
✓ run email:send using flags to set information using tilde in file path | |
✓ run email:send with default subject line and sending email address and relative path for attachment | |
✓ runs email:send without an attachment or prompt for one | |
✓ run email:send using stdin as the attachment source (112ms) | |
✓ run email:send using stdin as the attachment source but missing a To | |
✓ run email:send with an attachment and set the correct content-type for plaintext files | |
✓ run email:send with an attachment and set the correct content-type for non-text files | |
✓ run email:send with an attachment and fall back to text/plain for unknown file types | |
commands | |
set | |
✓ run email:set to set a new default sending email and subject with flags | |
✓ run email:set to set a new default sending email and subject | |
✓ run email:set to set a new default sending email and subject when a default has already been setup | |
✓ run email:set with invalid email and correct subject line when a default has already been set up | |
commands | |
feedback | |
✓ runs feedback | |
commands | |
phone-numbers | |
list | |
✓ runs incoming-phone-number:list | |
✓ runs incoming-phone-number:list with custom properties | |
commands | |
phone-numbers | |
update | |
✓ runs incoming-phone-number:update PN1234567890abcdef1234567890abcdef --friendly-name <name> | |
✓ runs incoming-phone-number:update PN1234567890abcdef1234567890abcdef --sms-url <url> | |
✓ should return nothing to update if no properties passed | |
✓ runs incoming-phone-number:update PN1234567890abcdef1234567890abcdef --sms-url <LOCALHOST url> and starts ngrok | |
✓ runs incoming-phone-number:update PN1234567890abcdef1234567890abcdef --sms-url <https LOCALHOST url> and starts ngrok | |
» WARNING: Detected localhost URL. | |
» For convenience, we will automatically create an encrypted tunnel using the 3rd-party service https://ngrok.io | |
» While running, this will expose your computer to the internet. | |
» Please exit this command after testing. | |
twilio-cli configuration saved to "/var/folders/vm/hj9l4ljn0_3dnbp_1fgtg46r0000gn/T/tmp-29753-jfQOgO0z3eCi/config.json" | |
✓ runs incoming-phone-number:update PN1234567890abcdef1234567890abcdef --sms-url <https LOCALHOST url> and catches the ngrok error | |
✓ runs incoming-phone-number:update with multiple urls and multiple ngrok tunnels | |
✓ handles generic ngrok errors | |
✓ handles complex ngrok errors | |
commands | |
plugins | |
available | |
✓ should print out available plugins | |
✓ should not print out installed plugins | |
commands | |
profiles | |
create | |
✓ runs profiles:create (980ms) | |
✓ runs profiles:create with existing profile in Projects | |
✓ runs profiles:create with existing profile in Projects with Keytar remove failed | |
✓ truncates apiKeyFriendlyName to 64 characters | |
✓ handles bad user info (1829ms) | |
✓ fails for invalid account SIDs | |
✓ fails for invalid Auth Tokens | |
✓ can skip parameter validation | |
✓ prompts when creating default profile with env vars set (1976ms) | |
✓ fails for invalid credentials | |
✓ fails to create an API key | |
✓ supports other regions | |
commands | |
profiles | |
list | |
✓ runs profiles:list with no profiles | |
✓ runs profiles:list with 1 profile | |
✓ runs profiles:list with 1 profile without active profile | |
✓ runs profiles:list with environment variables set | |
✓ runs profiles:list with multiple profiles and with active profile | |
✓ runs profiles:list with multiple profiles without a active profile | |
✓ runs profiles:list with multiple profiles from projects | |
✓ when the active profile is set from profiles | |
✓ when the active profile is set from projects | |
✓ runs profiles:list with 1 regional profile set and with multiple profiles | |
commands | |
profiles | |
port | |
Porting profile1... | |
✓ should port all projects to profiles in config | |
✓ Should only port profile3 to profiles | |
✓ should not port any non-existing profile | |
✓ should ignore keytar profile removal | |
✓ should not not initiate port process if not confirmed by user | |
✓ should inform in case of no profiles to port | |
✓ Should not port profile in case credentials can not be fetched from keytar | |
commands | |
profiles | |
remove | |
✓ run profiles:remove with a profile in keytar and deletes local key but keep remote key | |
✓ run profiles:remove with a profile in config file but keep remote key | |
✓ run profiles:remove with a profile and fails to delete both keys | |
✓ run profiles:remove with the active profile and deletes both keys | |
✓ run profiles:remove with the active profile and deletes both remote keys and config profile | |
✓ run profiles:remove with profile and deletes local key but can not delete remote key (1090ms) | |
✓ run profiles:remove with a profile and decide not to remove profile | |
✓ run profiles:remove with the last configured profile in keytar and delete all keys | |
✓ run profiles:remove with the last configured profile in config file and delete all keys | |
✓ run profiles:remove with non-existing profile | |
commands | |
profiles | |
use | |
✓ should set the active profile with id | |
✓ run profiles:active with non-existing profile | |
commands | |
zork | |
✓ tries to install zork and fails | |
✓ tries to install zork and runs it | |
hooks | |
command-not-found | |
✓ warns and installs non-installed plugin topics | |
✓ warns and install non-installed plugins commands | |
✓ does nothing for installed plugins or unknown commands | |
hooks | |
init | |
buy-phone-number | |
✓ creates the proper commands | |
✓ allows purchasing a phone number (55ms) | |
✓ does nothing if the API commands plugin is not found | |
✓ does nothing if no phone number list commands are found | |
✓ does nothing if the phone number create command is not found | |
hooks | |
init | |
plugin-verification | |
✓ outputs nothing for just core plugins | |
✓ outputs nothing if no conflicts in installed plugins | |
✓ warns for each conflicting command | |
hooks | |
init | |
twilio-api | |
✓ provides multiple resources and actions (170ms) | |
hooks | |
plugin-install | |
✓ warning when non Twilio plugin is installed | |
✓ warning when plugin is undefined | |
✓ outputs nothing when Twilio plugin is installed | |
services/api-schema | |
json-validator | |
[DEBUG] No validation function for "object" schema type | |
✓ handles new schema types | |
[DEBUG] No validation function for "password" schema format | |
✓ handles new string formats | |
array-type | |
✓ validates happy paths | |
✓ reports too few items | |
✓ reports too many items | |
✓ reports unique constraint violations | |
✓ reports nested value violations | |
✓ reports invalid types | |
boolean-type | |
✓ validates happy paths | |
✓ reports invalid booleans | |
integer-type | |
✓ validates happy paths | |
✓ reports invalid integers | |
✓ reports min violations | |
✓ reports max violations | |
✓ reports multiple-of violations | |
✓ reports multiple violations | |
number-type | |
✓ validates happy paths | |
✓ reports invalid numbers | |
string-type | |
✓ validates happy paths | |
✓ reports bad values | |
string-type-enum | |
✓ validates happy paths | |
✓ reports bad values | |
string-type-date | |
✓ validates happy paths | |
✓ reports bad values | |
string-type-date-time | |
✓ validates happy paths | |
✓ reports bad values | |
string-type-uri | |
✓ validates happy paths | |
✓ reports bad values | |
services/api-schema | |
twilio-validator | |
string-type-date | |
✓ accepts any string | |
✓ reports non-strings | |
string-type-date-time | |
✓ accepts any string | |
✓ reports non-strings | |
string-type-uri | |
✓ accepts any string | |
✓ reports non-strings | |
services | |
post-install-utility | |
************************************************************************* | |
* * | |
* To get started, please create a twilio-cli profile: * | |
* * | |
* twilio login * | |
* * | |
* OR * | |
* * | |
* twilio profiles:create * | |
* * | |
************************************************************************* | |
✓ should display grid when no profiles or projects configured | |
» Profiles exist with API keys in system keychain. Please run twilio profiles:port to port all keys to the config file | |
✓ should display port warning if projects set | |
✓ should not display port warning if profiles set, but projects not set | |
✓ should initialise as per system defaults | |
utility | |
resource-helpers | |
api | |
v2010 | |
incoming-phone-number | |
✓ finds number by valid sid | |
✓ doesn't find number by invalid sid | |
✓ handles error looking up phone number sid | |
✓ finds number by valid phone number | |
✓ doesn't find number by invalid phone number | |
✓ handles error looking up phone number | |
services | |
twilio-api | |
getTopicName | |
✓ handles a simple, non-nested resource path | |
✓ handles a nested resource path with parameters | |
✓ handles v2010 APIs | |
getActionDescription | |
✓ returns existing action description | |
✓ returns a default List action description | |
✓ returns a default Create action description | |
✓ returns a default Fetch action description | |
✓ returns a default Remove action description | |
✓ handles actions with maturity | |
✓ ignores GA maturity level | |
✓ handles actions with maturity and descriptions | |
✓ handles actions with multiple maturities and description | |
185 passing (10s) | |
-------------------------------------|---------|----------|---------|---------|---------------------------- | |
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | |
-------------------------------------|---------|----------|---------|---------|---------------------------- | |
All files | 97.97 | 93.7 | 97.47 | 98 | | |
base-commands | 95.92 | 85.71 | 100 | 95.74 | | |
twilio-api-command.js | 95.92 | 85.71 | 100 | 95.74 | 97,102 | |
commands | 100 | 100 | 100 | 100 | | |
feedback.js | 100 | 100 | 100 | 100 | | |
zork.js | 100 | 100 | 100 | 100 | | |
commands/config | 98.28 | 95.83 | 100 | 98.28 | | |
list.js | 100 | 100 | 100 | 100 | | |
set.js | 97.78 | 95 | 100 | 97.78 | 25 | |
commands/debugger/logs | 97.83 | 100 | 100 | 97.73 | | |
list.js | 97.83 | 100 | 100 | 97.73 | 90 | |
commands/email | 100 | 100 | 100 | 100 | | |
send.js | 100 | 100 | 100 | 100 | | |
set.js | 100 | 100 | 100 | 100 | | |
commands/phone-numbers | 95.95 | 89.66 | 87.5 | 95.89 | | |
list.js | 100 | 100 | 100 | 100 | | |
update.js | 95.45 | 89.66 | 85.71 | 95.38 | 39,87,134 | |
commands/plugins | 100 | 100 | 100 | 100 | | |
available.js | 100 | 100 | 100 | 100 | | |
commands/profiles | 96.68 | 88.3 | 92.11 | 96.62 | | |
create.js | 93.33 | 79.63 | 86.96 | 93.28 | 56,65,75,87,94,108,162-174 | |
list.js | 100 | 100 | 100 | 100 | | |
port.js | 100 | 100 | 100 | 100 | | |
remove.js | 100 | 100 | 100 | 100 | | |
use.js | 100 | 100 | 100 | 100 | | |
hooks | 100 | 80 | 100 | 100 | | |
command-not-found.js | 100 | 83.33 | 100 | 100 | 29 | |
plugin-install.js | 100 | 75 | 100 | 100 | 19 | |
hooks/init | 95.83 | 86.36 | 97.56 | 96.15 | | |
buy-phone-number.js | 96.2 | 80 | 93.33 | 97.3 | 47,66 | |
plugin-verification.js | 100 | 100 | 100 | 100 | | |
twilio-api.js | 93.65 | 83.33 | 100 | 93.44 | 89,94-96 | |
services | 100 | 100 | 100 | 100 | | |
config-utility.js | 100 | 100 | 100 | 100 | | |
email-utility.js | 100 | 100 | 100 | 100 | | |
file-io.js | 100 | 100 | 100 | 100 | | |
plugins.js | 100 | 100 | 100 | 100 | | |
post-install-utility.js | 100 | 100 | 100 | 100 | | |
services/api-schema | 100 | 97.37 | 100 | 100 | | |
json-validator.js | 100 | 97.37 | 100 | 100 | 85,94 | |
schema-validator.js | 100 | 100 | 100 | 100 | | |
twilio-validator.js | 100 | 100 | 100 | 100 | | |
services/messaging | 100 | 100 | 100 | 100 | | |
help-messages.js | 100 | 100 | 100 | 100 | | |
templates.js | 100 | 100 | 100 | 100 | | |
services/resource-helpers/api/v2010 | 100 | 100 | 100 | 100 | | |
incoming-phone-number.js | 100 | 100 | 100 | 100 | | |
services/twilio-api | 100 | 97.56 | 100 | 100 | | |
api-command-runner.js | 100 | 94.12 | 100 | 100 | 69 | |
get-action-description.js | 100 | 100 | 100 | 100 | | |
get-flag-config.js | 100 | 100 | 100 | 100 | | |
get-topic-name.js | 100 | 100 | 100 | 100 | | |
index.js | 100 | 100 | 100 | 100 | | |
-------------------------------------|---------|----------|---------|---------|---------------------------- | |
> twilio-cli@2.24.0 posttest | |
> npm run lint && npm audit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment