Skip to content

Commit 562e406

Browse files
committed
test(Menu): fix menu test
1 parent 6c499ac commit 562e406

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/specs/collections/Menu/Menu-test.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import _ from 'lodash'
21
import React from 'react'
32

43
import Menu from 'src/collections/Menu/Menu'
@@ -51,13 +50,17 @@ describe('Menu', () => {
5150
})
5251

5352
it('is set when clicking an item', () => {
54-
// random item, skip the first as its selected by default
55-
const randomIndex = _.random(items.length - 1)
53+
const wrapper = mount(<Menu items={items} />)
5654

57-
mount(<Menu items={items} />)
55+
wrapper
5856
.find('MenuItem')
59-
.at(randomIndex)
57+
.at(1)
6058
.simulate('click')
59+
60+
// must re-query for the menu items or we get a cached copy
61+
wrapper
62+
.find('MenuItem')
63+
.at(1)
6164
.should.have.prop('active', true)
6265
})
6366
})

0 commit comments

Comments
 (0)