Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Jan 7, 2022
1 parent 76d7b69 commit 2d9882c
Show file tree
Hide file tree
Showing 22 changed files with 445 additions and 414 deletions.
778 changes: 365 additions & 413 deletions dependencygraph.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lib/build-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import cpx from 'cpx2'
const copy = cpx.copy

export function getCopyGlob (src) {
// TODO: make this customizeable?
return `${src}/**/!(*.js|*.css|*.html|*.md)`
}

Expand Down
2 changes: 1 addition & 1 deletion lib/identify-pages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tap.test('identifyPages works as expected', async (t) => {
t.equal(Object.keys(results.pages).length, 11, '11 pages are found')

t.equal(results.warnings.length, 0, '0 warnings produced')
t.equal(results.nonPageFolders.length, 1, '1 non-page-folder')
t.equal(results.nonPageFolders.length, 2, '2 non-page-folder')
t.equal(results.pages.find(p => p.path === 'html-page').page.type, 'html', 'html page is type html')
t.equal(results.pages.find(p => p.path === 'md-page').page.type, 'md', 'md page is type md')
t.equal(results.pages.find(p => p.path === 'js-page').page.type, 'js', 'js-page is type js')
Expand Down
8 changes: 8 additions & 0 deletions test-cases/default-layout/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
testVar: frontmatter var
---
# Default layout title

This site uses the default layout.
You are free to use this, but it may change over time.

3 changes: 3 additions & 0 deletions test-cases/default-layout/src/global.vars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
siteName: 'Default Layout Test'
}
4 changes: 4 additions & 0 deletions test-cases/default-layout/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* You can still do page styles and get the default layout. */
.root-page-style {
background: blue;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions test-cases/general-features/src/md-page/page.vars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async () => ({
mdPageVars: true
})
8 changes: 8 additions & 0 deletions test-cases/nested-dest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
testVar: frontmatter var
---
# Default layout title

This site uses the default layout.
You are free to use this, but it may change over time.

3 changes: 3 additions & 0 deletions test-cases/nested-dest/global.vars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
siteName: 'Default Layout Test'
}
3 changes: 3 additions & 0 deletions test-cases/nested-dest/md-page/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# md-page

This is an md page rendered from a README.md in a folder.
1 change: 1 addition & 0 deletions test-cases/nested-dest/md-page/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('This only runs in md-page')
Binary file added test-cases/nested-dest/md-page/img/favicon-16x16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions test-cases/nested-dest/md-page/loose-md.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
loosemMd: vars
---
# loose-md

This is just a loose MD file. They don't have as many features right now.
3 changes: 3 additions & 0 deletions test-cases/nested-dest/md-page/md-no-style-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# md-no-style-or-client

This is just a README in a folder with no other auxilary files.
3 changes: 3 additions & 0 deletions test-cases/nested-dest/md-page/page.vars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async () => ({
mdPageVars: true
})
3 changes: 3 additions & 0 deletions test-cases/nested-dest/md-page/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.md-page-style {
background: yellow;
}
4 changes: 4 additions & 0 deletions test-cases/nested-dest/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* You can still do page styles and get the default layout. */
.root-page-style {
background: blue;
}
26 changes: 26 additions & 0 deletions test-cases/test-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,29 @@ tap.test('conflict-pages', async (t) => {

t.rejects(siteUp.build(), /Conflicting page sources/, 'Throws when conflicting page is found on build.')
})

tap.test('default-layout', async (t) => {
const src = path.join(__dirname, './default-layout/src')
const dest = path.join(__dirname, './default-layout/public')
const cwd = path.join(__dirname, './default-layout')
const siteUp = new Siteup(src, dest, cwd)

await rimrafP(dest)

await siteUp.build()

t.ok('built with default layout')
})

tap.test('nested-dest', async (t) => {
const src = path.join(__dirname, './nested-dest')
const dest = path.join(__dirname, './nested-dest/public')
const cwd = path.join(__dirname, './nested-dest')
const siteUp = new Siteup(src, dest, cwd)

await rimrafP(dest)

await siteUp.build()

t.ok('built with default layout')
})

0 comments on commit 2d9882c

Please sign in to comment.