@@ -121,15 +121,34 @@ describe('createMarkdownImages', function () {
121121 expect ( result ) . toEqual ( null )
122122 } )
123123 } )
124- describe ( 'when text contains only different extension' , function ( ) {
125- beforeEach ( function ( ) {
126- text = "hogehogehogehoge"
127- result = createMarkdownImages ( text , "" )
128- } )
129- it ( 'should return null ' , function ( ) {
130- expect ( result ) . toEqual ( null )
124+ describe ( 'when text contains supported extensions' , function ( ) {
125+ beforeEach ( function ( ) {
126+ text = "hogehoge\n \
127+ hogehoge\n \
128+ hogehoge\n \
129+ hogehoge"
130+ result = createMarkdownImages ( text , "" )
131+ } )
132+ it ( 'should match four md images' , function ( ) {
133+ let extensions = [ "jpg" , "png" , "jpeg" , "gif" ]
134+ expect ( result . length ) . toEqual ( 4 )
135+
136+ result . forEach ( ( markdownImage , index ) => {
137+ expect ( markdownImage . url ) . toEqual ( `https://user-images.githubusercontent.com/test${ index } .${ extensions [ index ] } ` )
138+ expect ( markdownImage . imageTag ) . toEqual ( `<img src=https://user-images.githubusercontent.com/test${ index } .${ extensions [ index ] } >` )
139+ expect ( markdownImage . mdImageText ) . toEqual ( `` )
131140 } )
132141 } )
142+ } )
143+ describe ( 'when text contains only different extension' , function ( ) {
144+ beforeEach ( function ( ) {
145+ text = "hogehogehogehoge"
146+ result = createMarkdownImages ( text , "" )
147+ } )
148+ it ( 'should return null ' , function ( ) {
149+ expect ( result ) . toEqual ( null )
150+ } )
151+ } )
133152 describe ( 'when text contains md image' , function ( ) {
134153 describe ( 'when text contains one md image' , function ( ) {
135154 beforeEach ( function ( ) {
0 commit comments