Commit 6ad6dd58 authored by Robert Knight's avatar Robert Knight

Add a note about why test uses mount rather than shallow rendering

Also mock the `MenuItem` component manually so that any problems with
that component won't cause a cascade of failures in `GroupListItem`.
parent 60364fb4
...@@ -48,7 +48,13 @@ describe('GroupListItem', () => { ...@@ -48,7 +48,13 @@ describe('GroupListItem', () => {
leave: sinon.stub(), leave: sinon.stub(),
}; };
function FakeMenuItem() {
return null;
}
FakeMenuItem.displayName = 'MenuItem';
GroupListItem.$imports.$mock({ GroupListItem.$imports.$mock({
'./menu-item': FakeMenuItem,
'../util/group-list-item-common': fakeGroupListItemCommon, '../util/group-list-item-common': fakeGroupListItemCommon,
'../store/use-store': callback => callback(fakeStore), '../store/use-store': callback => callback(fakeStore),
}); });
...@@ -62,6 +68,10 @@ describe('GroupListItem', () => { ...@@ -62,6 +68,10 @@ describe('GroupListItem', () => {
}); });
const createGroupListItem = (fakeGroup, props = {}) => { const createGroupListItem = (fakeGroup, props = {}) => {
// nb. Mount rendering is used here with a manually mocked `MenuItem`
// because `GroupListItem` renders multiple top-level elements (wrapped in
// a fragment) and `wrapper.update()` cannot be used in that case when using
// shallow rendering.
return mount( return mount(
<GroupListItem <GroupListItem
group={fakeGroup} group={fakeGroup}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment