Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bumping enzyme to latest version #1055

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const defaultTestProps: ActionItemDisplayProps = {
describe("Action Item Display component", () => {
it("renders correctly when there are no action items.", () => {
const wrapper = shallow(<ActionItemDisplay {...defaultTestProps} />);
const component = wrapper.children().dive();
const component = (wrapper.children().dive() as unknown) as React.ReactElement;
expect(toJson(component)).toMatchSnapshot();
});

Expand Down
11 changes: 5 additions & 6 deletions src/frontend/components/__tests__/boardSummary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,24 @@ const mockedWorkItemCountProps: IBoardSummaryProps = {

describe('Board Summary', () => {
it('renders with no action or work items.', () => {
const wrapper = shallow(<BoardSummary {...mockedDefaultProps} />);
const component = wrapper.children().dive();

const wrapper = shallow<IBoardSummaryProps>(<BoardSummary {...mockedDefaultProps} />);
const component = wrapper.dive();
verifySummaryBoardCounts(component, mockedDefaultProps);
verifyActionItemsSummaryCard(component, false);
});

it('renders with one action item.', () => {
mockedDefaultProps.actionItems.push(mockWorkItem);
mockedDefaultProps.supportedWorkItemTypes.push(mockWorkItemType);
const wrapper = shallow(<BoardSummary {...mockedDefaultProps} />);
const wrapper = shallow(<BoardSummary {...mockedDefaultProps} /> as any);
const component = wrapper.children().dive();

verifySummaryBoardCounts(component, mockedDefaultProps);
verifyActionItemsSummaryCard(component, true);
});

it('renders when work item counts are greater than zero.', () => {
const wrapper = shallow(<BoardSummary {...mockedWorkItemCountProps} />);
const wrapper = shallow(<BoardSummary {...mockedWorkItemCountProps} /> as any);
const component = wrapper.children().dive();

verifySummaryBoardCounts(component, mockedWorkItemCountProps);
Expand All @@ -52,7 +51,7 @@ describe('Board Summary', () => {
it('renders with one action item when work item counts are greater than zero.', () => {
mockedWorkItemCountProps.actionItems.push(mockWorkItem);
mockedWorkItemCountProps.supportedWorkItemTypes.push(mockWorkItemType);
const wrapper = shallow(<BoardSummary {...mockedWorkItemCountProps} />);
const wrapper = shallow(<BoardSummary {...mockedWorkItemCountProps} /> as any);
const component = wrapper.children().dive();

verifySummaryBoardCounts(component, mockedWorkItemCountProps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mockedProps = mocked({
describe('Editable Document Card Title ', () => {
it('can be rendered when enabled.', () => {
mockedProps.isDisabled = true;
const wrapper = shallow(<EditableDocumentCardTitle {...mockedProps} />);
const wrapper = shallow(<EditableDocumentCardTitle {...mockedProps} /> as any);
const component = wrapper.children().dive();

expect(component.prop('className')).toBe('editable-document-card-title');
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/components/__tests__/editableText.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ const mockedTestProps: EditableTextProps = {
describe('Editable Text Component', () => {
it('renders correctly.', () => {
const wrapper = shallow(<EditableText {...mockedTestProps} />);
const component = wrapper.children().dive();
const component = wrapper.dive();
expect(toJson(component)).toMatchSnapshot();
});

it('updates text appropriately.', () => {
mockedTestProps.text = 'Test Text';

const wrapper = shallow(<EditableText {...mockedTestProps} />);
const wrapper = shallow(<EditableText {...mockedTestProps} /> as any);
const component = wrapper.children().dive();
expect(toJson(component)).toMatchSnapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jest.mock('uuid', () => ({ v4: () => mockUuid}));
describe('Board Metadata Form', () => {
it('can be rendered', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const component = wrapper.children().dive();
const component = (wrapper.children().dive() as unknown) as ShallowWrapper;
const textField = component.findWhere(c => c.prop('id') === 'retrospective-title-input').find(TextField);

expect(textField).toBeDefined();
Expand All @@ -36,7 +36,7 @@ describe('Board Metadata Form', () => {
})

it('should set the title to nothing', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'retrospective-title-input').find(TextField);

Expand All @@ -45,7 +45,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set max votes settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'max-vote-counter').find(TextField);

Expand All @@ -54,7 +54,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set include team assessment settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'include-team-assessment-checkbox').find(Checkbox);

Expand All @@ -64,7 +64,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set obscure feedback settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'obscure-feedback-checkbox').find(Checkbox);

Expand All @@ -74,7 +74,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set prime directive setting', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'display-prime-directive').find(Checkbox);

Expand All @@ -84,7 +84,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set display names settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'feedback-display-names-checkbox').find(Checkbox);

Expand All @@ -94,7 +94,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set the column list', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const list = component.find(List).first();

Expand All @@ -115,7 +115,7 @@ describe('Board Metadata Form', () => {
})

it('should set the title', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'retrospective-title-input').find(TextField);

Expand All @@ -124,7 +124,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set max votes settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'max-vote-counter').find(TextField);

Expand All @@ -133,7 +133,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set include team assessment settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'include-team-assessment-checkbox').find(Checkbox);

Expand All @@ -143,7 +143,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set obscure feedback settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'obscure-feedback-checkbox').find(Checkbox);

Expand All @@ -153,7 +153,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set prime directive setting', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'display-prime-directive').find(Checkbox);

Expand All @@ -163,7 +163,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set display names settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'feedback-display-names-checkbox').find(Checkbox);

Expand All @@ -173,7 +173,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set the column list', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const list = component.find(List).first();

Expand All @@ -195,7 +195,7 @@ describe('Board Metadata Form', () => {
})

it('should set the title with the duplicate copy addition', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'retrospective-title-input').find(TextField);

Expand All @@ -204,7 +204,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set max votes settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'max-vote-counter').find(TextField);

Expand All @@ -213,7 +213,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set include team assessment settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'include-team-assessment-checkbox').find(Checkbox);

Expand All @@ -223,7 +223,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set obscure feedback settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'obscure-feedback-checkbox').find(Checkbox);

Expand All @@ -233,7 +233,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set prime directive setting', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'display-prime-directive').find(Checkbox);

Expand All @@ -243,7 +243,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set display names settings', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const checkbox = component.findWhere(c => c.prop('id') === 'feedback-display-names-checkbox').find(Checkbox);

Expand All @@ -253,7 +253,7 @@ describe('Board Metadata Form', () => {
});

it('should properly set the column list', () => {
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataForm {...mockedProps} /> as any);
const component = wrapper.children().dive();
const list = component.find(List).first();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Board Metadata Form Permissions', () => {
});

it('can be rendered', () => {
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...mockedProps} /> as any);
const component = wrapper.children().dive();
const textField = component.findWhere(c => c.prop('id') === 'retrospective-permission-search-input').find(TextField);

Expand All @@ -36,7 +36,7 @@ describe('Board Metadata Form Permissions', () => {
const publicBannerText: string = 'This board is visible to every member in the project.';

it('should show when there are not team or member permissions', () => {
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...mockedProps} />);
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...mockedProps} /> as any);
const component = wrapper.children().dive();
const element = component.findWhere(c => c.text() === publicBannerText);

Expand All @@ -51,7 +51,7 @@ describe('Board Metadata Form Permissions', () => {
Members: [] as string[]
}
};
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} />);
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} /> as any);
const component = wrapper.children().dive();
const element = component.findWhere(c => c.text() === publicBannerText);

Expand All @@ -66,7 +66,7 @@ describe('Board Metadata Form Permissions', () => {
Members: [testUserId]
}
};
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} />);
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} /> as any);
const component = wrapper.children().dive();
const element = component.findWhere(c => c.text() === publicBannerText);

Expand Down Expand Up @@ -96,7 +96,7 @@ describe('Board Metadata Form Permissions', () => {
}
]
};
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} />);
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} /> as any);
const component = wrapper.children().dive();
const tableBody = component.find('tbody');
const tableRows = tableBody.find('tr');
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Board Metadata Form Permissions', () => {
}
]
};
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} />);
const wrapper = shallow(<FeedbackBoardMetadataFormPermissions {...props} /> as any);
const component = wrapper.children().dive();
const tableBody = component.find('tbody');
const tableRows = tableBody.find('tr');
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Board Metadata Form Permissions', () => {
}
]
};
const wrapper = mount(<FeedbackBoardMetadataFormPermissions {...props} />);
const wrapper = mount(<FeedbackBoardMetadataFormPermissions {...props} /> as any);
const tableBody = wrapper.find('tbody');
const tableRows = tableBody.find('tr');

Expand Down Expand Up @@ -290,7 +290,7 @@ describe('Board Metadata Form Permissions', () => {
}
]
};
const wrapper = mount(<FeedbackBoardMetadataFormPermissions {...props} />);
const wrapper = mount(<FeedbackBoardMetadataFormPermissions {...props} /> as any);
const tableBody = wrapper.find('tbody');
const tableRows = tableBody.find('tr');

Expand Down
10 changes: 5 additions & 5 deletions src/frontend/components/__tests__/feedbackCarousel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jest.mock('uuid', () => ({ v4: () => mockUuid}));

describe('Feedback Carousel ', () => {
it('can be rendered', () => {
const wrapper = shallow(<FeedbackCarousel {...mockedProps} />);
const wrapper = shallow(<FeedbackCarousel {...mockedProps} /> as any);
const component = wrapper.children().dive();
expect(component.prop('className')).toBe('feedback-carousel-pivot');
expect(component.findWhere(c => c.prop('headerText') === testColumnProps.columnName)).toHaveLength(1);
});

test('that groupIds are empty when there are no children', () => {
const wrapper = shallow(<FeedbackCarousel {...mockedProps} />);
const wrapper = shallow(<FeedbackCarousel {...mockedProps} /> as any);
const component = wrapper.children().dive();

const feedbackItem = component.findWhere(c => c.prop('className') === 'feedback-carousel-item').find(FeedbackItem).first();
Expand All @@ -37,7 +37,7 @@ describe('Feedback Carousel ', () => {
})

test('that groupIds are populate when there are children', () => {
const wrapper = shallow(<FeedbackCarousel {...mockedGroupProps} />);
const wrapper = shallow(<FeedbackCarousel {...mockedGroupProps} /> as any);
const component = wrapper.children().dive();

const feedbackItem = component.findWhere(c => c.prop('className') === 'feedback-carousel-item').find(FeedbackItem).first();
Expand All @@ -48,7 +48,7 @@ describe('Feedback Carousel ', () => {

describe("'All' column", () => {
it("should be set by default in the first position", () => {
const wrapper = shallow(<FeedbackCarousel {...mockedProps} />);
const wrapper = shallow(<FeedbackCarousel {...mockedProps} /> as any);
const component = wrapper.children().dive();

const allColumn = component.findWhere(c => c.prop('headerText')).first();
Expand All @@ -57,7 +57,7 @@ describe('Feedback Carousel ', () => {
});

it("should not exist when there are no feedback columns", () => {
const wrapper = shallow(<FeedbackCarousel feedbackColumnPropsList={[]} isFeedbackAnonymous={true} isFocusModalHidden={false} />);
const wrapper = shallow(<FeedbackCarousel feedbackColumnPropsList={[]} isFeedbackAnonymous={true} isFocusModalHidden={false} /> as any);
const component = wrapper.children().dive();

const allColumn = component.findWhere(c => c.prop('headerText')).first();
Expand Down
Loading
Loading