File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,23 @@ describe('phone-regex', function() {
2929 assert . equal ( phone ( { exact : true } ) . test ( '1 123 456 7890' ) , true ) ;
3030 } ) ;
3131
32- it ( 'should not find a phone number if it is not exact' , function ( ) {
32+ it ( 'should not find a phone number if it is not exact' , function ( ) {
3333 assert . equal ( phone ( { exact : true } ) . test ( 'apples 1 123 456 7890' ) , false ) ;
3434 } ) ;
3535 } ) ;
36+
37+ describe ( 'g' , function ( ) {
38+
39+ it ( 'should find a phone number when it exists' , function ( ) {
40+ assert . equal ( phone ( ) . test ( 'apples 1 123 456 7890' ) , true ) ;
41+ } ) ;
42+
43+ it ( 'should find all phone numbers in a string' , function ( ) {
44+ assert . equal ( '1 123 456 7890 orange (123) 456-7890' . match ( phone ( ) ) . length , 2 ) ;
45+ } ) ;
46+
47+ it ( 'should not find phone numbers when they do not exist' , function ( ) {
48+ assert . equal ( 'pineapples' . match ( phone ( ) ) , null ) ;
49+ } ) ;
50+ } ) ;
3651} ) ;
You can’t perform that action at this time.
0 commit comments