Skip to content

Commit 8dc6b5a

Browse files
committed
Fix assertions for specs testing references data.
1 parent 2015870 commit 8dc6b5a

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

tests/unit/components/ContentNode/LinksBlock.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const createWrapper = ({ propsData, ...others } = {}) => shallowMount(LinksBlock
4141
describe('LinksBlock', () => {
4242
it('renders the LinksBlock', () => {
4343
const wrapper = createWrapper();
44-
expect(wrapper.find(TopicsLinkCardGrid).props()).toEqual({
44+
expect(wrapper.find(TopicsLinkCardGrid).props()).toMatchObject({
4545
items: [references.foo, references.bar],
4646
topicStyle: defaultProps.blockStyle,
4747
usePager: false,
@@ -60,7 +60,7 @@ describe('LinksBlock', () => {
6060
// they are two, because one does not have a reference object
6161
const linkBlocks = wrapper.findAll(TopicsLinkBlock);
6262
expect(linkBlocks).toHaveLength(2);
63-
expect(linkBlocks.at(0).props('topic')).toEqual(references.foo);
64-
expect(linkBlocks.at(1).props('topic')).toEqual(references.bar);
63+
expect(linkBlocks.at(0).props('topic')).toMatchObject(references.foo);
64+
expect(linkBlocks.at(1).props('topic')).toMatchObject(references.bar);
6565
});
6666
});

tests/unit/components/DocumentationTopic/Relationships.spec.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,16 @@ describe('Relationships', () => {
9191
expect(firstSection.props('anchor')).toBe(propsData.sections[0].anchor);
9292
const firstList = firstSection.find(List);
9393
expect(firstList.exists()).toBe(true);
94-
expect(firstList.props('symbols')).toEqual([
95-
foo,
96-
bar,
97-
]);
94+
expect(firstList.props('symbols')[0]).toMatchObject(foo);
95+
expect(firstList.props('symbols')[1]).toMatchObject(bar);
9896
expect(firstList.props('type')).toEqual('inheritsFrom');
9997

10098
const lastSection = sections.at(1);
10199
expect(lastSection.props('title')).toBe(propsData.sections[1].title);
102100
expect(lastSection.props('anchor')).toBe(null);
103101
const lastList = lastSection.find(List);
104102
expect(lastList.exists()).toBe(true);
105-
expect(lastList.props('symbols')).toEqual([baz]);
103+
expect(lastList.props('symbols')[0]).toMatchObject(baz);
106104
expect(firstList.props('type')).toEqual('inheritsFrom');
107105
});
108106
});

tests/unit/components/DocumentationTopic/TopicsLinkCardGridItem.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('TopicsLinkCardGridItem', () => {
124124
},
125125
},
126126
});
127-
expect(wrapper.find(TopicTypeIcon).props('imageOverride')).toEqual(iconRef);
127+
expect(wrapper.find(TopicTypeIcon).props('imageOverride')).toMatchObject(iconRef);
128128
});
129129

130130
it('renders a TopicsLinkCardGridItem, in a none compact variant', async () => {

tests/unit/components/DocumentationTopic/TopicsTable.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('TopicsTable', () => {
116116
const firstSectionBlocks = sections.at(0).findAll(TopicsLinkBlock);
117117
expect(firstSectionBlocks.length).toBe(1);
118118
expect(firstSectionBlocks.at(0).classes('topic')).toBe(true);
119-
expect(firstSectionBlocks.at(0).props()).toEqual({
119+
expect(firstSectionBlocks.at(0).props()).toMatchObject({
120120
topic: foo,
121121
isSymbolDeprecated: false,
122122
isSymbolBeta: false,
@@ -125,7 +125,7 @@ describe('TopicsTable', () => {
125125
const lastSectionBlocks = sections.at(1).findAll(TopicsLinkBlock);
126126
expect(lastSectionBlocks.length).toBe(1);
127127
expect(lastSectionBlocks.at(0).classes('topic')).toBe(true);
128-
expect(lastSectionBlocks.at(0).props()).toEqual({
128+
expect(lastSectionBlocks.at(0).props()).toMatchObject({
129129
topic: baz,
130130
isSymbolDeprecated: false,
131131
isSymbolBeta: false,
@@ -139,15 +139,15 @@ describe('TopicsTable', () => {
139139

140140
const firstGrid = sections.at(0).find(TopicsLinkCardGrid);
141141
expect(firstGrid.classes('topic')).toBe(true);
142-
expect(firstGrid.props()).toEqual({
142+
expect(firstGrid.props()).toMatchObject({
143143
topicStyle: TopicSectionsStyle.compactGrid,
144144
items: [foo],
145145
usePager: false,
146146
});
147147

148148
const secondGrid = sections.at(1).find(TopicsLinkCardGrid);
149149
expect(secondGrid.classes('topic')).toBe(true);
150-
expect(secondGrid.props()).toEqual({
150+
expect(secondGrid.props()).toMatchObject({
151151
topicStyle: TopicSectionsStyle.compactGrid,
152152
items: [baz],
153153
usePager: false,

tests/unit/components/ReferenceUrlProvider.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('ReferenceUrlProvider', () => {
5353

5454
const reference = references['doc://com.example.Test/tutorials/TechnologyX/Getting-Started'];
5555

56-
expect(assertProps).toEqual({
56+
expect(assertProps).toMatchObject({
5757
title: reference.title,
5858
url: reference.url,
5959
urlWithParams: `${reference.url}?context=foo`,

tests/unit/components/Tutorial/Hero.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('Hero', () => {
112112
const metadata = wrapper.find(HeroMetadata);
113113
expect(metadata.props('estimatedTimeInMinutes')).toBe(estimatedTimeInMinutes);
114114
expect(metadata.props('projectFilesUrl')).toBe(projectFilesUrl);
115-
expect(metadata.props('xcodeRequirement')).toEqual(xcodeRequirementReference);
115+
expect(metadata.props('xcodeRequirement')).toMatchObject(xcodeRequirementReference);
116116
});
117117

118118
it('renders a div for the background and selects the light variant', () => {

0 commit comments

Comments
 (0)