From ed6c6cfadddcfb109ec79b875f2f89cdc6489d1c Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Sun, 13 Jan 2019 20:01:46 +0200 Subject: [PATCH] Add tests --- .../test/integration/markdown/100x100.png | Bin 0 -> 255 bytes .../test/integration/markdown/index.md | 2 ++ .../core/integration-tests/test/markdown.js | 33 ++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 packages/core/integration-tests/test/integration/markdown/100x100.png create mode 100644 packages/core/integration-tests/test/markdown.js diff --git a/packages/core/integration-tests/test/integration/markdown/100x100.png b/packages/core/integration-tests/test/integration/markdown/100x100.png new file mode 100644 index 0000000000000000000000000000000000000000..8a1daa0121d524256c1d1b45ff5e7ed771784c52 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^DImVS)*E46%Oq(`s&YU^>_U&7| zc=6GrN4Ia^zG~H~jT<-Ko_$0QsEo6~BeIx*f$sR&2=kJHM z&5N9@w|=XzipNCbb|s-xrJeH)f2E%im~OIrio1Qy&Sj1+>x<+1)+oPni}kGd6Ohy! z>6x1RttNZTv!7LG>?+Ii&zjEnadB}e3778<6P>u`Anzuis~9|8{an^LB{Ts5qZeh6 literal 0 HcmV?d00001 diff --git a/packages/core/integration-tests/test/integration/markdown/index.md b/packages/core/integration-tests/test/integration/markdown/index.md index c641f4265c9..d1d6628f15c 100644 --- a/packages/core/integration-tests/test/integration/markdown/index.md +++ b/packages/core/integration-tests/test/integration/markdown/index.md @@ -1,3 +1,5 @@ # heading1 content content content + +[image](./100x100.png) diff --git a/packages/core/integration-tests/test/markdown.js b/packages/core/integration-tests/test/markdown.js new file mode 100644 index 00000000000..017e8fe9d33 --- /dev/null +++ b/packages/core/integration-tests/test/markdown.js @@ -0,0 +1,33 @@ +const assert = require('assert'); +const path = require('path'); +const fs = require('@parcel/fs'); +const {bundle, run, assertBundleTree} = require('./utils'); + +describe('markdown', function() { + it('should support bundling Markdown', async function() { + let b = await bundle( + path.join(__dirname, '/integration/markdown/index.md') + ); + + await assertBundleTree(b, { + name: 'index.html', + assets: ['index.md'], + childBundles: [ + { + type: 'png', + assets: ['100x100.png'], + childBundles: [] + } + ] + }); + + let files = await fs.readdir(path.join(__dirname, '/dist')); + let html = await fs.readFile(path.join(__dirname, '/dist/index.html')); + for (let file of files) { + let ext = file.match(/\.([0-9a-z]+)(?:[?#]|$)/i)[0]; + if (file !== 'index.html' && ext !== '.map') { + assert(html.includes(file)); + } + } + }); +});