Skip to content

Commit

Permalink
Added test for asset subfolder.
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Dec 17, 2018
1 parent c9bb068 commit 299e1e5
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/asset-folder/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -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 */"
`;
1 change: 1 addition & 0 deletions test/asset-folder/content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Hello
Binary file added test/asset-folder/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions test/asset-folder/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
font-size: 20px;
background: url(./image.png) top left repeat;
}
6 changes: 6 additions & 0 deletions test/asset-folder/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import content from "./content.md"
import css from "./index.css"

export default function() {
return content + css
}
14 changes: 14 additions & 0 deletions test/asset-folder/index.test.js
Original file line number Diff line number Diff line change
@@ -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")
})

0 comments on commit 299e1e5

Please sign in to comment.