@@ -16,7 +16,6 @@ describe('internet', () => {
1616 'avatar' ,
1717 'protocol' ,
1818 'httpMethod' ,
19- 'url' ,
2019 'domainName' ,
2120 'domainSuffix' ,
2221 'domainWord' ,
@@ -61,6 +60,15 @@ describe('internet', () => {
6160 t . describe ( 'emoji' , ( t ) => {
6261 t . it ( 'noArgs' ) . it ( 'with options' , { types : [ 'nature' ] } ) ;
6362 } ) ;
63+
64+ t . describe ( 'url' , ( t ) => {
65+ t . it ( 'noArgs' )
66+ . it ( 'with slash appended' , { appendSlash : true } )
67+ . it ( 'without slash appended and with http protocol' , {
68+ appendSlash : false ,
69+ protocol : 'http' ,
70+ } ) ;
71+ } ) ;
6472 } ) ;
6573
6674 describe ( `random seeded tests for seed ${ faker . seed ( ) } ` , ( ) => {
@@ -325,6 +333,23 @@ describe('internet', () => {
325333 expect ( url ) . toBeTypeOf ( 'string' ) ;
326334 expect ( url ) . toSatisfy ( validator . isURL ) ;
327335 } ) ;
336+
337+ it ( 'should return a valid url with slash appended at the end' , ( ) => {
338+ const url = faker . internet . url ( { appendSlash : true } ) ;
339+
340+ expect ( url ) . toBeTruthy ( ) ;
341+ expect ( url ) . toBeTypeOf ( 'string' ) ;
342+ expect ( url ) . toSatisfy ( validator . isURL ) ;
343+ expect ( url . endsWith ( '/' ) ) . toBeTruthy ( ) ;
344+ } ) ;
345+
346+ it ( 'should return a valid url with given protocol' , ( ) => {
347+ const url = faker . internet . url ( { protocol : 'http' } ) ;
348+
349+ expect ( url ) . toBeTruthy ( ) ;
350+ expect ( url ) . toBeTypeOf ( 'string' ) ;
351+ expect ( url ) . toSatisfy ( validator . isURL ) ;
352+ } ) ;
328353 } ) ;
329354
330355 describe ( 'domainName()' , ( ) => {
0 commit comments