diff --git a/tests/browser/basic.js b/tests/browser/basic.js
index e9a7fba..46745f6 100644
--- a/tests/browser/basic.js
+++ b/tests/browser/basic.js
@@ -1,61 +1,59 @@
-const tape = require('tape')
+const test = require('tape')
const choo = require('../../')
const view = require('../../html')
-tape('should render on the client', function (t) {
- t.test('state should not be mutable', function (t) {
- t.plan(4)
+test('state is immutable', function (t) {
+ t.plan(4)
- const app = choo()
- const state = {
- foo: 'baz',
- beep: 'boop'
- }
+ const app = choo()
+ const state = {
+ foo: 'baz',
+ beep: 'boop'
+ }
- app.model({
- state: state,
- namespace: 'test',
- reducers: {
- 'no-reducer-mutate': (action, state) => {
- return {}
- },
- 'mutate-on-return': (action, state) => {
- delete action.type
- return action
- }
+ app.model({
+ state: state,
+ namespace: 'test',
+ reducers: {
+ 'no-reducer-mutate': (action, state) => {
+ return {}
},
- effects: {
- 'triggers-reducers': (action, state, send, done) => {
- send('test:mutate-on-return', {beep: 'barp'}, done)
- }
+ 'mutate-on-return': (action, state) => {
+ delete action.type
+ return action
}
- })
-
- let loop = -1
-
- const asserts = [
- (state) => t.deepEqual(state, {foo: 'baz', beep: 'boop'}, 'intial state'),
- (state) => t.deepEqual(state, {foo: 'baz', beep: 'boop'}, 'no change in state'),
- (state) => t.deepEqual(state, {foo: 'oof', beep: 'boop'}, 'change in state from reducer'),
- (state) => t.deepEqual(state, {foo: 'oof', beep: 'barp'}, 'change in state from effect')
- ]
-
- const triggers = [
- (send) => send('test:no-reducer-mutate'),
- (send) => send('test:mutate-on-return', {foo: 'oof'}),
- (send) => send('test:triggers-reducers')
- ]
-
- app.router((route) => [
- route('/', function (state, prev, send) {
- ++loop
- asserts[loop] && asserts[loop](state.test)
- setTimeout(() => triggers[loop] && triggers[loop](send), 5)
- return view`
${state.foo}:${state.beep}
`
- })
- ])
-
- const tree = app.start()
- document.body.appendChild(tree)
+ },
+ effects: {
+ 'triggers-reducers': (action, state, send, done) => {
+ send('test:mutate-on-return', {beep: 'barp'}, done)
+ }
+ }
})
+
+ let loop = -1
+
+ const asserts = [
+ (state) => t.deepEqual(state, {foo: 'baz', beep: 'boop'}, 'intial state'),
+ (state) => t.deepEqual(state, {foo: 'baz', beep: 'boop'}, 'no change in state'),
+ (state) => t.deepEqual(state, {foo: 'oof', beep: 'boop'}, 'change in state from reducer'),
+ (state) => t.deepEqual(state, {foo: 'oof', beep: 'barp'}, 'change in state from effect')
+ ]
+
+ const triggers = [
+ (send) => send('test:no-reducer-mutate'),
+ (send) => send('test:mutate-on-return', {foo: 'oof'}),
+ (send) => send('test:triggers-reducers')
+ ]
+
+ app.router((route) => [
+ route('/', function (state, prev, send) {
+ ++loop
+ asserts[loop] && asserts[loop](state.test)
+ setTimeout(() => triggers[loop] && triggers[loop](send), 5)
+ return view`${state.foo}:${state.beep}
`
+ })
+ ])
+
+ const tree = app.start()
+ document.body.appendChild(tree)
})
diff --git a/tests/server/index.js b/tests/server/index.js
index 7d5a440..871b035 100644
--- a/tests/server/index.js
+++ b/tests/server/index.js
@@ -1,10 +1,10 @@
-const tape = require('tape')
+const test = require('tape')
const minDocument = require('min-document')
const choo = require('../../')
const view = require('../../html')
-tape('should render on the server', function (t) {
- t.test('should render a static response', function (t) {
+test('server', function (t) {
+ t.test('renders a static html response', function (t) {
t.plan(1)
const app = choo()
@@ -17,7 +17,7 @@ tape('should render on the server', function (t) {
t.equal(html, expected, 'strings are equal')
})
- t.test('can render without a real DOM', function (t) {
+ t.test('renders without a real DOM', function (t) {
t.plan(1)
const app = choo()
@@ -30,7 +30,7 @@ tape('should render on the server', function (t) {
t.equal(html, expected, 'strings are equal')
})
- t.test('should accept a state object', function (t) {
+ t.test('receives a state object', function (t) {
t.plan(1)
const app = choo()
@@ -45,7 +45,7 @@ tape('should render on the server', function (t) {
t.equal(html, expected, 'strings are equal')
})
- t.test('should extend flat existing models', function (t) {
+ t.test('extends flat existing models', function (t) {
t.plan(1)
const app = choo()
@@ -62,7 +62,7 @@ tape('should render on the server', function (t) {
t.equal(html, expected, 'strings are equal')
})
- t.test('should extend namespaced existing models', function (t) {
+ t.test('extends namespaced existing models', function (t) {
t.plan(1)
const app = choo()
@@ -89,7 +89,7 @@ tape('should render on the server', function (t) {
t.equal(html, expected, 'strings are equal')
})
- t.test('should throw if called without route', function (t) {
+ t.test('throws if called without route', function (t) {
t.plan(1)
const app = choo()
@@ -102,7 +102,7 @@ tape('should render on the server', function (t) {
t.throws(app.toString.bind(null), /route must be a string/)
})
- t.test('should throw if calling send()', function (t) {
+ t.test('throws when calling send()', function (t) {
t.plan(1)
const app = choo()