Skip to content

Commit 2c58ddf

Browse files
committed
Add test for Medium hosted image
1 parent 0142ae6 commit 2c58ddf

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

spec/Flatten.coffee

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,38 @@ describe 'Flatten', ->
745745
chai.expect(data).to.deep.eql expected
746746
done()
747747

748+
describe 'flattening content from Medium hosted image', ->
749+
it 'should produce an article block', (done) ->
750+
if console.timeEnd
751+
console.time 'flattening HTML structures'
752+
sent =
753+
path: 'medium.html'
754+
items: [
755+
id: 'fake-medium'
756+
html: "<figure><img src='https://cdn-images-1.medium.com/max/1200/1*f7gpfegwe5jhpYs_1R_neA.jpeg'></figure>"
757+
]
758+
759+
expected =
760+
path: 'medium.html'
761+
items: [
762+
id: 'fake-medium'
763+
content: [
764+
type: 'image'
765+
src: 'https://cdn-images-1.medium.com/max/1200/1*f7gpfegwe5jhpYs_1R_neA.jpeg'
766+
html: "<figure><img src=\"https://cdn-images-1.medium.com/max/1200/1*f7gpfegwe5jhpYs_1R_neA.jpeg\"></figure>"
767+
]
768+
]
769+
770+
f.processPage sent, (err, data) ->
771+
if console.timeEnd
772+
console.timeEnd 'flattening HTML structures'
773+
return done err if err
774+
chai.expect(data).to.deep.eql expected
775+
done()
776+
777+
778+
779+
748780
describe 'flattening a full XHTML file', ->
749781
# return if window?
750782
it 'should produce flattened contents', (done) ->

0 commit comments

Comments
 (0)