Skip to content

Commit

Permalink
fix(core): siblings initialized as empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Feb 26, 2021
1 parent ad78b85 commit 93c1508
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/lib/plugins/history.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/core/src/plugins/history.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports =
->
action = await handler.call null, ...arguments
action.children = []
action.siblings ?= []
action.siblings = action.parent.children if action.parent
action.sibling = action.siblings.slice(-1)[0] if action.parent
action
Expand Down
4 changes: 4 additions & 0 deletions packages/core/test/plugins/history.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ describe 'plugins.history', ->
.should.be.resolvedWith 'mayday'

describe 'siblings', ->

it 'start with empty array', ->
nikita ({siblings}) ->
siblings.should.eql []

it 'get previous action', ->
nikita.call ({context}) ->
Expand Down

0 comments on commit 93c1508

Please sign in to comment.