Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test case for #259 #260

Merged
merged 1 commit into from
Apr 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
17 changes: 17 additions & 0 deletions test/fixtures/path-not-ending-in-slash/html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'

export default function html (props) {
return (
<html>
<head>
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: props.body }} />
</body>
</html>
)
}

html.propTypes = {
body: React.PropTypes.string,
}
9 changes: 9 additions & 0 deletions test/fixtures/path-not-ending-in-slash/pages/_template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

export default function template (props) {
return <div>{props.children}</div>
}

template.propTypes = {
children: React.PropTypes.any,
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Hello World
date: "2015-05-01T22:12:03.284Z"
path: "/hello-world"
---

![An Image](./image.jpg)
26 changes: 26 additions & 0 deletions test/integration/user-rewrites-path-not-ending-in-slash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import test from 'ava'
import path from 'path'
import Promise from 'bluebird'
import { build } from '../support'
import fse from 'fs-extra'
const fs = Promise.promisifyAll(fse)

const fixturePath = path.resolve('..', 'fixtures', 'path-not-ending-in-slash')

test.before('build the site', async () => {
await build(fixturePath)
})

test('the index page has been moved to the hardcoded path', async t => {
const indexPath = path.resolve(fixturePath, 'public', 'hello-world', 'index.html')
const file = await fs.statAsync(indexPath)

t.truthy(file)
})

test("the image has been moved to match the moved page's path", async t => {
const imagePath = path.resolve(fixturePath, 'public', 'hello-world', 'image.jpg')
const file = await fs.statAsync(imagePath)

t.truthy(file)
})