Fixing consistency of signatures.
This commit is contained in:
@@ -16,16 +16,16 @@ test('state is immutable', function (t) {
|
||||
state: state,
|
||||
namespace: 'test',
|
||||
reducers: {
|
||||
'no-reducer-mutate': (action, state) => {
|
||||
'no-reducer-mutate': (data, state) => {
|
||||
return {}
|
||||
},
|
||||
'mutate-on-return': (action, state) => {
|
||||
delete action.type
|
||||
return action
|
||||
'mutate-on-return': (data, state) => {
|
||||
delete data.type
|
||||
return data
|
||||
}
|
||||
},
|
||||
effects: {
|
||||
'triggers-reducers': (action, state, send, done) => {
|
||||
'triggers-reducers': (data, state, send, done) => {
|
||||
send('test:mutate-on-return', {beep: 'barp'}, done)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ test('hooks', function (t) {
|
||||
onError: function (err) {
|
||||
t.equal(err.message, 'effect error', 'onError: receives err')
|
||||
},
|
||||
onAction: function (action, state, name, caller, createSend) {
|
||||
onAction: function (data, state, name, caller, createSend) {
|
||||
if (name === 'explodes') return
|
||||
t.deepEqual(action, {foo: 'bar'}, 'onAction: action data')
|
||||
t.deepEqual(data, {foo: 'bar'}, 'onAction: action data')
|
||||
t.equal(state.clicks, 0, 'onAction: current state: 0 clicks')
|
||||
t.equal(name, 'click', 'onAction: action name')
|
||||
t.equal(caller, 'view: /', 'onAction: caller name')
|
||||
t.equal(typeof createSend, 'function', 'onAction: createSend fn')
|
||||
},
|
||||
onStateChange: function (action, state, prev, createSend) {
|
||||
t.deepEqual(action, {foo: 'bar'}, 'onState: action data')
|
||||
onStateChange: function (data, state, prev, createSend) {
|
||||
t.deepEqual(data, {foo: 'bar'}, 'onState: action data')
|
||||
t.deepEqual(state.clicks, 1, 'onState: new state: 1 clicks')
|
||||
t.deepEqual(prev.clicks, 0, 'onState: prev state: 0 clicks')
|
||||
}
|
||||
@@ -30,10 +30,10 @@ test('hooks', function (t) {
|
||||
clicks: 0
|
||||
},
|
||||
reducers: {
|
||||
click: (action, state) => ({clicks: state.clicks + 1})
|
||||
click: (data, state) => ({clicks: state.clicks + 1})
|
||||
},
|
||||
effects: {
|
||||
explodes: (action, state, send, done) => {
|
||||
explodes: (data, state, send, done) => {
|
||||
setTimeout(() => done(new Error('effect error')), 5)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ test('routing', function (t) {
|
||||
user: null
|
||||
},
|
||||
reducers: {
|
||||
set: (action, state) => ({user: action.id})
|
||||
set: (data, state) => ({user: data.id})
|
||||
},
|
||||
effects: {
|
||||
open: function (action, state, send, done) {
|
||||
t.deepEqual(action, {id: 1})
|
||||
open: function (data, state, send, done) {
|
||||
t.deepEqual(data, {id: 1})
|
||||
send('set', {id: 1}, function (err) {
|
||||
if (err) return done(err)
|
||||
history.broadcast('https://foo.com/users/1')
|
||||
@@ -74,10 +74,10 @@ test('routing', function (t) {
|
||||
user: null
|
||||
},
|
||||
reducers: {
|
||||
set: (action, state) => ({user: action.id})
|
||||
set: (data, state) => ({user: data.id})
|
||||
},
|
||||
effects: {
|
||||
open: function (action, state, send, done) {
|
||||
open: function (data, state, send, done) {
|
||||
send('set', {id: 1}, function (err) {
|
||||
if (err) return done(err)
|
||||
hash.broadcast('#users/1')
|
||||
|
||||
Reference in New Issue
Block a user