Assert that tree exists, fix tests (#358)

* assert that tree exists, fix tests

* make assertions more helpful
This commit is contained in:
Tim Wisniewski
2016-12-22 06:55:36 -05:00
committed by GitHub
parent ff1073a664
commit 3b5740c00e
4 changed files with 12 additions and 20 deletions
+7 -19
View File
@@ -125,6 +125,7 @@ test('routing', function (t) {
app.router('/', [
['/', function () {
t.pass('rendered')
return document.createElement('div')
}]
])
@@ -139,7 +140,10 @@ test('routing', function (t) {
})
const app = choo({ href: false })
app.router(['/', () => t.pass('rendered')])
app.router(['/', function () {
t.pass('rendered')
return document.createElement('div')
}])
app.start()
})
@@ -152,30 +156,14 @@ test('routing', function (t) {
app.router({ default: '/users/123' }, [
['/users', [
['/:user', function (state) {
t.deepEqual(state.params, {user: '123'})
t.deepEqual(state.location.params, {user: '123'})
return document.createElement('div')
}]
]]
])
app.start()
})
t.test('prev.params always exists', function (t) {
t.plan(1)
const choo = require('../..')
const app = choo()
app.router('/users/123', (route) => [
route('/users', [
route('/:user', function (state, prev) {
t.ok(prev.params)
})
])
])
app.start()
})
})
function resetLocation () {