File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed
Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 2929 " /yarn.lock"
3030 ],
3131 "homepage" : " https://github.com/twilio-labs/plugin-token" ,
32- "keywords" : [
33- " oclif-plugin"
34- ],
32+ "keywords" : [" oclif-plugin" ],
3533 "license" : " MIT" ,
3634 "oclif" : {
3735 "name" : " token" ,
3836 "commands" : " ./src/commands" ,
3937 "bin" : " twilio" ,
40- "devPlugins" : [
41- " @oclif/plugin-help"
42- ],
38+ "devPlugins" : [" @oclif/plugin-help" ],
4339 "topics" : {
4440 "token" : {
4541 "description" : " Generate a temporary token for use in test applications"
Original file line number Diff line number Diff line change 1+ const chai = require ( 'chai' ) ;
2+ const validateSid =
3+ require ( '../../src/helpers/validation-helpers.js' ) . validateSid ;
4+
5+ describe ( 'validateSid' , ( ) => {
6+ context ( 'when a chat service SID is valid' , ( ) => {
7+ it ( 'returns true' , ( ) => {
8+ const result = validateSid ( 'IS' , 'IS12345678901234567890123456789012' ) ;
9+ chai . expect ( result ) . to . be . true ;
10+ } ) ;
11+ } ) ;
12+
13+ context ( 'when a service SID is invalid' , ( ) => {
14+ context ( 'does not start with the correct prefix' , ( ) => {
15+ it ( 'returns false' , ( ) => {
16+ const result = validateSid ( 'IS' , 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ) ;
17+ chai . expect ( result ) . to . be . false ;
18+ } ) ;
19+ } ) ;
20+ context ( 'is not 34 characters long' , ( ) => {
21+ it ( 'returns false' , ( ) => {
22+ const result = validateSid ( 'IS' , 'IS1234567890' ) ;
23+ chai . expect ( result ) . to . be . false ;
24+ } ) ;
25+ } ) ;
26+ } ) ;
27+ } ) ;
You can’t perform that action at this time.
0 commit comments