Skip to content

Commit

Permalink
Update ava to 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benstepp committed Apr 8, 2016
1 parent cb5d140 commit 3434e49
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"yaml-loader": "^0.1.0"
},
"devDependencies": {
"ava": "^0.13.0",
"ava": "^0.14.0",
"babel-cli": "^6.6.5",
"babel-eslint": "^6.0.0",
"eslint": "^2.4.0",
Expand Down Expand Up @@ -114,7 +114,9 @@
"watch": "babel -w lib --out-dir dist/"
},
"ava": {
"require": [ "babel-register" ],
"require": [
"babel-register"
],
"babel": "inherit"
}
}
16 changes: 8 additions & 8 deletions test/utils/build-page/path-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import pathResolver from '../../../lib/utils/build-page/path-resolver'
test('it returns an object', t => {
const pagePath = '/'
const result = pathResolver(pagePath)
t.ok(result)
t.truthy(result)
t.is(typeof result, 'object')
})

test('it has a require path', t => {
const pagePath = '/a-blog-post/index.md'
const result = pathResolver(pagePath)
t.ok(result.requirePath)
t.truthy(result.requirePath)
t.is(typeof result.requirePath, 'string')
})

Expand All @@ -24,15 +24,15 @@ test('it does not has a path if the name start with _', t => {
})

test('it has a path if the name doesnt start with _', t => {
t.ok(pathResolver('/2015/back-to-the-future.md').path)
t.ok(pathResolver('/my-first-blog.md').path)
t.ok(pathResolver('/index.md').path)
t.truthy(pathResolver('/2015/back-to-the-future.md').path)
t.truthy(pathResolver('/my-first-blog.md').path)
t.truthy(pathResolver('/index.md').path)
})

test('it has a templatePath if the name is _template', t => {
const pagePath = '/_template.js'
const result = pathResolver(pagePath)
t.ok(result.templatePath)
t.truthy(result.templatePath)
t.is(typeof result.templatePath, 'string')
})

Expand All @@ -46,8 +46,8 @@ test('the directory name has / slashes', t => {
const pagePath = '/2016/testing-middleman-sites-with-capybara/index.md'
const result = pathResolver(pagePath)

t.same(result.file.dirname, path.posix.normalize(result.file.dirname))
t.same(result.file.dirname, '/2016/testing-middleman-sites-with-capybara')
t.is(result.file.dirname, path.posix.normalize(result.file.dirname))
t.is(result.file.dirname, '/2016/testing-middleman-sites-with-capybara')
})

test('the ext doesnt have a leading .', t => {
Expand Down
14 changes: 7 additions & 7 deletions test/utils/build-page/url-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@ test('uses the path from page data', t => {
const parsedPath = { name: 'page', dirname: 'a-directory/' }
const data = { path: '/page-at-root' }
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/page-at-root')
t.is(pagePath, '/page-at-root')
})

test('removes index from path', t => {
const parsedPath = { name: 'index', dirname: 'foo/bar' }
const data = {}
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/foo/bar/')
t.is(pagePath, '/foo/bar/')
})

test('removes template from path', t => {
const parsedPath = { name: 'template', dirname: 'foo/bar' }
const data = {}
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/foo/bar/')
t.is(pagePath, '/foo/bar/')
})

test('template at root has root path', t => {
const parsedPath = { name: 'template', dirname: '' }
const data = {}
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/')
t.is(pagePath, '/')
})

test('index at root has root path', t => {
const parsedPath = { name: 'index', dirname: '' }
const data = {}
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/')
t.is(pagePath, '/')
})

test('if not an index create a path like /foo/bar/', t => {
const parsedPath = { name: 'creating-static-websites', dirname: 'blog/2016' }
const data = {}
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/blog/2016/creating-static-websites/')
t.is(pagePath, '/blog/2016/creating-static-websites/')
})

test('if not an index create a path like /foo/bar/', t => {
const parsedPath = { name: 'about-us', dirname: '' }
const data = {}
const pagePath = urlResolver(data, parsedPath)
t.same(pagePath, '/about-us/')
t.is(pagePath, '/about-us/')
})

0 comments on commit 3434e49

Please sign in to comment.