Skip to content

Commit 63a85bf

Browse files
committed
Fix stringification of lifecycle methods
1 parent 4a3d038 commit 63a85bf

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/__tests__/send-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ describe('send', function() {
5959
assert.equal(answer, 'test')
6060
})
6161

62+
it ('allows lifecycle methods as registered actions', function() {
63+
let store = {
64+
register() {
65+
return { [lifecycle.willStart]: 'test' }
66+
}
67+
}
68+
69+
let answer = send(store, null, lifecycle.willStart)
70+
71+
assert.equal(answer, 'test')
72+
})
73+
6274
it ('ignores methods defined by the store that are not lifecycle methods matching dispatched types', function() {
6375
let store = {
6476
foo() {

src/lifecycle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exports.mapping = {
1010
'willDeserialize' : 'deserialize'
1111
}
1212

13-
for (var type in exports.mapping) {
13+
for (let type in exports.mapping) {
1414
exports[type] = { type }
15+
exports[type].toString = () => type
1516
}

0 commit comments

Comments
 (0)