Skip to content

Commit e563eca

Browse files
committed
cast wrapper.instance() to prevent type errors
1 parent 9a6a4ef commit e563eca

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/components/skills/SkillsSection.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ describe("`SkillsSection`", () => {
9595
it("can sort skills by `repoCount`", () => {
9696
const wrapper = shallow<SkillsSection>(<SkillsSection {...props} />);
9797

98-
wrapper.instance().handleSort(getFakeEventWithValue("Repo Count"));
98+
(wrapper.instance() as SkillsSection).handleSort(getFakeEventWithValue("Repo Count"));
9999

100-
const comparator: SkillSortComparator = wrapper.state("sortComparator");
100+
const comparator: SkillSortComparator = (wrapper.state("sortComparator") as SkillSortComparator);
101101

102102
expect(comparator).toEqual(repoCountComparator);
103103
});
104104

105105
it("can sort skills by `name`", () => {
106106
const wrapper = shallow<SkillsSection>(<SkillsSection {...props} />);
107107

108-
wrapper.instance().handleSort(getFakeEventWithValue("Skill Name"));
108+
(wrapper.instance() as SkillsSection).handleSort(getFakeEventWithValue("Skill Name"));
109109

110110
const comparator: SkillSortComparator = wrapper.state("sortComparator");
111111

@@ -116,8 +116,8 @@ describe("`SkillsSection`", () => {
116116
const wrapper = shallow<SkillsSection>(<SkillsSection {...props} />);
117117

118118
// sort away from initial sort, to sort back again
119-
wrapper.instance().handleSort(getFakeEventWithValue("Name"));
120-
wrapper.instance().handleSort(getFakeEventWithValue("Recency"));
119+
(wrapper.instance() as SkillsSection).handleSort(getFakeEventWithValue("Name"));
120+
(wrapper.instance() as SkillsSection).handleSort(getFakeEventWithValue("Recency"));
121121

122122
const comparator: SkillSortComparator = wrapper.state("sortComparator");
123123

src/components/skills/SkillsSectionContainer.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ describe.skip("`SkillsSectionContainer`", () => {
3030
<SkillsSectionContainer rawSkills={MOCK_RAW_SKILLS} />
3131
);
3232

33-
wrapper
34-
.instance()
33+
(wrapper
34+
.instance() as SkillsSectionContainer)
3535
.componentDidMount()
3636
.then(() => {
3737
// expect(axios.get).toHaveBeenCalledTimes(1);

0 commit comments

Comments
 (0)