@@ -14,18 +14,17 @@ describe('CommentParser', () => {
1414 test ( 'returns a link when there is one' , ( ) => {
1515 expect (
1616 parser . parseComment ( 'One link: https://psalm.dev/r/0f9f06ebd6' )
17- )
18- . toEqual ( [
19- { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' }
20- ] )
17+ ) . toEqual ( [
18+ { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' , params : '' }
19+ ] )
2120 } )
2221
2322 test ( 'returns all links when there are many' , ( ) => {
2423 expect (
2524 parser . parseComment ( 'psalm.dev/r/0f9f06ebd6 and psalm.dev/r/whatever are not the same' )
2625 ) . toEqual ( [
27- { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' } ,
28- { link : 'https://psalm.dev/r/whatever' , snippet : 'whatever' }
26+ { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' , params : '' } ,
27+ { link : 'https://psalm.dev/r/whatever' , snippet : 'whatever' , params : '' }
2928 ] )
3029 } )
3130
@@ -37,16 +36,16 @@ describe('CommentParser', () => {
3736 expect (
3837 parser . parseComment ( comment )
3938 ) . toEqual ( [
40- { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' } ,
41- { link : 'https://psalm.dev/r/whatever' , snippet : 'whatever' }
39+ { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' , params : '' } ,
40+ { link : 'https://psalm.dev/r/whatever' , snippet : 'whatever' , params : '' }
4241 ] )
4342 } )
4443
4544 test ( 'returns unique links' , ( ) => {
4645 expect (
4746 parser . parseComment ( 'https://psalm.dev/r/0f9f06ebd6 and https://psalm.dev/r/0f9f06ebd6 are the same link' )
4847 ) . toEqual ( [
49- { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' }
48+ { link : 'https://psalm.dev/r/0f9f06ebd6' , snippet : '0f9f06ebd6' , params : '' }
5049 ] )
5150 } )
5251
@@ -61,4 +60,10 @@ describe('CommentParser', () => {
6160 }
6261 ] )
6362 } )
63+
64+ test ( 'returns empty string as params for links without params' , ( ) => {
65+ expect (
66+ parser . parseComment ( 'One link: https://psalm.dev/r/0f9f06ebd6' ) [ 0 ] . params
67+ ) . toEqual ( '' )
68+ } )
6469} )
0 commit comments