File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ const chai = require ( 'chai' ) ;
2+ const sinon = require ( 'sinon' ) ;
3+ const Twilio = require ( 'twilio' ) ;
4+
5+ const validateSid = require ( '../../src/helpers/validation-helpers.js' ) . validateSid ;
6+
7+ describe ( 'validateSid' , ( ) => {
8+ context (
9+ 'when a chat service SID is valid' ,
10+ ( ) => {
11+ it ( 'returns true' , ( ) => {
12+ const result = validateSid ( 'IS' , 'IS12345678901234567890123456789012' ) ;
13+ chai . expect ( result ) . to . be . true ;
14+ } ) ;
15+ } ,
16+ ) ;
17+
18+ context (
19+ 'when a service SID is invalid' , ( ) => {
20+ context ( 'does not start with the correct prefix' , ( ) => {
21+ it ( 'returns false' , ( ) => {
22+ const result = validateSid ( 'IS' , 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ) ;
23+ chai . expect ( result ) . to . be . false ;
24+ } ) ;
25+ } )
26+ context ( 'is not 34 characters long' , ( ) => {
27+ it ( 'returns false' , ( ) => {
28+ const result = validateSid ( 'IS' , 'IS1234567890' ) ;
29+ chai . expect ( result ) . to . be . false ;
30+ } ) ;
31+ } )
32+ } ) ;
33+ } ) ;
You can’t perform that action at this time.
0 commit comments