@@ -38,6 +38,19 @@ describe("convertToImgTag", function(){
3838 expect ( result ) . toEqual ( null )
3939 } )
4040 } )
41+
42+ describe ( 'when text does not contain file extension' , function ( ) {
43+ beforeEach ( function ( ) {
44+ text = "hogehoge\n \
45+ hogehoge"
46+ result = convertToImgTag ( text , "" )
47+ } )
48+ it ( 'should return replaced text' , function ( ) {
49+ text = "hogehoge<img src=https://user-images.githubusercontent.com/test0 >\n \
50+ hogehoge<img src=https://img.esa.io/uploads/production/pictures/image/test1 >"
51+ expect ( result ) . toEqual ( text )
52+ } )
53+ } )
4154} )
4255
4356describe ( "convertOnlySelectionToImgTag" , function ( ) {
@@ -213,13 +226,21 @@ describe('createMarkdownImages', function () {
213226 } )
214227 } )
215228 } )
216- describe ( 'when text contains only different extension' , function ( ) {
229+ describe ( 'when text does not contain file extension' , function ( ) {
217230 beforeEach ( function ( ) {
218- text = "hogehogehogehoge"
231+ text = "hogehogehogehoge"
219232 result = createMarkdownImages ( text , "" )
220233 } )
221- it ( 'should return null ' , function ( ) {
222- expect ( result ) . toEqual ( null )
234+ it ( 'should match one md image ' , function ( ) {
235+ let markdownImage = result [ 0 ]
236+ let imageURL = "https://user-images.githubusercontent.com/test"
237+ let imageTag = "<img src=https://user-images.githubusercontent.com/test >"
238+ let mdImageText = ""
239+
240+ expect ( result . length ) . toEqual ( 1 )
241+ expect ( markdownImage . url ) . toEqual ( imageURL )
242+ expect ( markdownImage . imageTag ) . toEqual ( imageTag )
243+ expect ( markdownImage . mdImageText ) . toEqual ( mdImageText )
223244 } )
224245 } )
225246 describe ( 'when text contains md image' , function ( ) {
0 commit comments