From 299e1e585c7804f542fe1f9e1aa973764e8aa810 Mon Sep 17 00:00:00 2001 From: Sebastian Werner Date: Mon, 17 Dec 2018 17:14:40 +0100 Subject: [PATCH] Added test for asset subfolder. --- .../__snapshots__/index.test.js.snap | 34 ++++++++++++++++++ test/asset-folder/content.md | 1 + test/asset-folder/image.png | Bin 0 -> 95 bytes test/asset-folder/index.css | 4 +++ test/asset-folder/index.js | 6 ++++ test/asset-folder/index.test.js | 14 ++++++++ 6 files changed, 59 insertions(+) create mode 100644 test/asset-folder/__snapshots__/index.test.js.snap create mode 100644 test/asset-folder/content.md create mode 100644 test/asset-folder/image.png create mode 100644 test/asset-folder/index.css create mode 100644 test/asset-folder/index.js create mode 100644 test/asset-folder/index.test.js diff --git a/test/asset-folder/__snapshots__/index.test.js.snap b/test/asset-folder/__snapshots__/index.test.js.snap new file mode 100644 index 0000000..a429ece --- /dev/null +++ b/test/asset-folder/__snapshots__/index.test.js.snap @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Asset Folder 1`] = ` +"bundled-assets +index.js" +`; + +exports[`Asset Folder 2`] = ` +"bXipeBrs.png +bsdudxaF.md +gToHHcDx.css +gToHHcDx.css.map" +`; + +exports[`Asset Folder 3`] = ` +"import content from './bundled-assets/bsdudxaF.md'; +import css from './bundled-assets/gToHHcDx.css'; + +function index() { + return content + css +} + +export default index; +" +`; + +exports[`Asset Folder 4`] = ` +"body { + font-size: 20px; + background: url(./bXipeBrs.png) top left repeat; +} + +/*# sourceMappingURL=gToHHcDx.css.map */" +`; diff --git a/test/asset-folder/content.md b/test/asset-folder/content.md new file mode 100644 index 0000000..fec5601 --- /dev/null +++ b/test/asset-folder/content.md @@ -0,0 +1 @@ +# Hello diff --git a/test/asset-folder/image.png b/test/asset-folder/image.png new file mode 100644 index 0000000000000000000000000000000000000000..c5916f289705642eec4975cf51458b9afeefe46c GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?juK#@*VoWXSL2@NQe!*uh mnS}iXa=1KQ978JRBqsscYz)k1<~1vTECx?kKbLh*2~7ZT-W2Wt literal 0 HcmV?d00001 diff --git a/test/asset-folder/index.css b/test/asset-folder/index.css new file mode 100644 index 0000000..1111deb --- /dev/null +++ b/test/asset-folder/index.css @@ -0,0 +1,4 @@ +body { + font-size: 20px; + background: url(./image.png) top left repeat; +} diff --git a/test/asset-folder/index.js b/test/asset-folder/index.js new file mode 100644 index 0000000..042b526 --- /dev/null +++ b/test/asset-folder/index.js @@ -0,0 +1,6 @@ +import content from "./content.md" +import css from "./index.css" + +export default function() { + return content + css +} diff --git a/test/asset-folder/index.test.js b/test/asset-folder/index.test.js new file mode 100644 index 0000000..e6cd8dc --- /dev/null +++ b/test/asset-folder/index.test.js @@ -0,0 +1,14 @@ +import { bundle, clean, list, read } from "../util" + +const root = __dirname + +test("Asset Folder", async () => { + await bundle(root, "index.js", "output/index.js", { folder: "bundled-assets" }) + + expect(await list(root, "output")).toMatchSnapshot() + expect(await list(root, "output/bundled-assets")).toMatchSnapshot() + expect(await read(root, "output/index.js")).toMatchSnapshot() + expect(await read(root, "output/bundled-assets/gToHHcDx.css")).toMatchSnapshot() + + await clean(root, "output") +})