Skip to content

Commit 0153ea2

Browse files
authored
chore: Remove outdated legacyRoot param from unit tests (RocketChat#36632)
1 parent dc6acda commit 0153ea2

9 files changed

Lines changed: 22 additions & 39 deletions

File tree

apps/meteor/client/components/GazzodownText.spec.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('GazzodownText highlights', () => {
5050
<GazzodownText>
5151
<HighlightTester text='Это тест сообщения' />
5252
</GazzodownText>,
53-
{ legacyRoot: true, wrapper: wrapper.build() },
53+
{ wrapper: wrapper.build() },
5454
);
5555
// Expect that the highlighted element wraps exactly "тест"
5656
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^тест$/i);
@@ -63,7 +63,7 @@ describe('GazzodownText highlights', () => {
6363
<GazzodownText>
6464
<HighlightTester text='Тест сообщения' />
6565
</GazzodownText>,
66-
{ legacyRoot: true, wrapper: wrapper.build() },
66+
{ wrapper: wrapper.build() },
6767
);
6868
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^тест$/i);
6969
});
@@ -75,7 +75,7 @@ describe('GazzodownText highlights', () => {
7575
<GazzodownText>
7676
<HighlightTester text='Тестирование сообщения' />
7777
</GazzodownText>,
78-
{ legacyRoot: true, wrapper: wrapper.build() },
78+
{ wrapper: wrapper.build() },
7979
);
8080
expect(screen.queryByTitle('Highlighted_chosen_word')).not.toBeInTheDocument();
8181
});
@@ -87,7 +87,7 @@ describe('GazzodownText highlights', () => {
8787
<GazzodownText>
8888
<HighlightTester text='Сообщение тест' />
8989
</GazzodownText>,
90-
{ legacyRoot: true, wrapper: wrapper.build() },
90+
{ wrapper: wrapper.build() },
9191
);
9292
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^тест$/i);
9393
});
@@ -99,7 +99,7 @@ describe('GazzodownText highlights', () => {
9999
<GazzodownText>
100100
<HighlightTester text='This is a test message' />
101101
</GazzodownText>,
102-
{ legacyRoot: true, wrapper: wrapper.build() },
102+
{ wrapper: wrapper.build() },
103103
);
104104
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
105105
});
@@ -111,7 +111,7 @@ describe('GazzodownText highlights', () => {
111111
<GazzodownText>
112112
<HighlightTester text='test is at the beginning, in the middle test, and at the end test' />
113113
</GazzodownText>,
114-
{ legacyRoot: true, wrapper: wrapper.build() },
114+
{ wrapper: wrapper.build() },
115115
);
116116
const highlightedElements = screen.getAllByTitle('Highlighted_chosen_word');
117117
// Expect three separate highlights.
@@ -133,7 +133,7 @@ in it.`;
133133
<GazzodownText>
134134
<HighlightTester text={multilineText} />
135135
</GazzodownText>,
136-
{ legacyRoot: true, wrapper: wrapper.build() },
136+
{ wrapper: wrapper.build() },
137137
);
138138
const highlightedElements = screen.getAllByTitle('Highlighted_chosen_word');
139139
// At least two occurrences are expected: one for "Test" (capitalized) and one for "test"
@@ -151,7 +151,7 @@ in it.`;
151151
<GazzodownText>
152152
<HighlightTester text='This is :test: inside colons' />
153153
</GazzodownText>,
154-
{ legacyRoot: true, wrapper: wrapper.build() },
154+
{ wrapper: wrapper.build() },
155155
);
156156
// The highlighted element should contain only "test"
157157
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
@@ -164,7 +164,7 @@ in it.`;
164164
<GazzodownText>
165165
<HighlightTester text='This is :test with colon at the start' />
166166
</GazzodownText>,
167-
{ legacyRoot: true, wrapper: wrapper.build() },
167+
{ wrapper: wrapper.build() },
168168
);
169169
// The highlighted element should contain only "test"
170170
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
@@ -177,7 +177,7 @@ in it.`;
177177
<GazzodownText>
178178
<HighlightTester text='This is test: with colon at end' />
179179
</GazzodownText>,
180-
{ legacyRoot: true, wrapper: wrapper.build() },
180+
{ wrapper: wrapper.build() },
181181
);
182182
// The highlighted element should contain only "test"
183183
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
@@ -190,7 +190,7 @@ in it.`;
190190
<GazzodownText>
191191
<HighlightTester text='This test message should highlight the word highlight in multiple places: test and highlight.' />
192192
</GazzodownText>,
193-
{ legacyRoot: true, wrapper: wrapper.build() },
193+
{ wrapper: wrapper.build() },
194194
);
195195

196196
const highlightedElements = screen.getAllByTitle('Highlighted_chosen_word');
@@ -209,7 +209,7 @@ in it.`;
209209
<GazzodownText>
210210
<HighlightTester text={testText} />
211211
</GazzodownText>,
212-
{ legacyRoot: true, wrapper: wrapper.build() },
212+
{ wrapper: wrapper.build() },
213213
);
214214

215215
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^te-st_te\.st\/te=te!st:$/i);
@@ -222,7 +222,7 @@ in it.`;
222222
<GazzodownText>
223223
<HighlightTester text='This is a test message' />
224224
</GazzodownText>,
225-
{ legacyRoot: true, wrapper: wrapper.build() },
225+
{ wrapper: wrapper.build() },
226226
);
227227
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
228228
});

apps/meteor/client/components/message/variants/SystemMessage.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ describe('SystemMessage', () => {
5656
it('should render system message', () => {
5757
const message = createBaseMessage('& test &');
5858

59-
render(<SystemMessage message={message} showUserAvatar />, { legacyRoot: true, wrapper: wrapper.build() });
59+
render(<SystemMessage message={message} showUserAvatar />, { wrapper: wrapper.build() });
6060

6161
expect(screen.getByText('changed room description to: & test &')).toBeInTheDocument();
6262
});
6363

6464
it('should not show escaped html while rendering system message', () => {
6565
const message = createBaseMessage('& test &');
6666

67-
render(<SystemMessage message={message} showUserAvatar />, { legacyRoot: true, wrapper: wrapper.build() });
67+
render(<SystemMessage message={message} showUserAvatar />, { wrapper: wrapper.build() });
6868

6969
expect(screen.getByText('changed room description to: & test &')).toBeInTheDocument();
7070
expect(screen.queryByText('changed room description to: &amp; test &amp;')).not.toBeInTheDocument();
@@ -73,7 +73,7 @@ describe('SystemMessage', () => {
7373
it('should not inject html', () => {
7474
const message = createBaseMessage('<button title="test-title">OK</button>');
7575

76-
render(<SystemMessage message={message} showUserAvatar />, { legacyRoot: true, wrapper: wrapper.build() });
76+
render(<SystemMessage message={message} showUserAvatar />, { wrapper: wrapper.build() });
7777

7878
expect(screen.queryByTitle('test-title')).not.toBeInTheDocument();
7979
expect(screen.getByText('changed room description to: <button title="test-title">OK</button>')).toBeInTheDocument();

apps/meteor/client/hooks/useUserCustomFields.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ it('should not break with invalid Accounts_CustomFieldsToShowInUserInfo setting'
1010
prop: 'value',
1111
}),
1212
{
13-
legacyRoot: true,
1413
wrapper: mockAppRoot()
1514
.withSetting('Accounts_CustomFieldsToShowInUserInfo', '{"Invalid": "Object", "InvalidProperty": "Invalid" }')
1615
.build(),

apps/meteor/client/views/admin/engagementDashboard/messages/useMessagesSent.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ it('should return utc time', async () => {
5656
},
5757
};
5858
const { result } = renderHook(() => useMessagesSent({ period: 'this week', utc: true }), {
59-
legacyRoot: true,
6059
wrapper: mockAppRoot()
6160
.withEndpoint('GET', '/v1/engagement-dashboard/messages/messages-sent', () => expectedResult)
6261
.build(),
@@ -117,7 +116,6 @@ it.skip('should return local time', async () => {
117116
},
118117
};
119118
const { result } = renderHook(() => useMessagesSent({ period: 'this week', utc: false }), {
120-
legacyRoot: true,
121119
wrapper: mockAppRoot()
122120
.withEndpoint('GET', '/v1/engagement-dashboard/messages/messages-sent', () => expectedResult)
123121
.build(),

apps/meteor/client/views/admin/engagementDashboard/users/useHourlyChatActivity.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ it('should return utc time', async () => {
2222
success: true,
2323
};
2424
const { result } = renderHook(() => useHourlyChatActivity({ displacement: 0, utc: true }), {
25-
legacyRoot: true,
2625
wrapper: mockAppRoot()
2726
.withEndpoint('GET', '/v1/engagement-dashboard/users/chat-busier/hourly-data', () => expectedResult)
2827
.build(),
@@ -76,7 +75,6 @@ it.skip('should return local time', async () => {
7675
};
7776

7877
const { result } = renderHook(() => useHourlyChatActivity({ displacement: 0, utc: false }), {
79-
legacyRoot: true,
8078
wrapper: mockAppRoot()
8179
.withEndpoint('GET', '/v1/engagement-dashboard/users/chat-busier/hourly-data', () => receivedData)
8280
.build(),

apps/meteor/client/views/admin/engagementDashboard/users/useNewUsers.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ it('should return utc time', async () => {
5656
},
5757
};
5858
const { result } = renderHook(() => useNewUsers({ period: 'this week', utc: true }), {
59-
legacyRoot: true,
6059
wrapper: mockAppRoot()
6160
.withEndpoint('GET', '/v1/engagement-dashboard/users/new-users', () => expectedResult)
6261
.build(),
@@ -117,7 +116,6 @@ it.skip('should return local time', async () => {
117116
},
118117
};
119118
const { result } = renderHook(() => useNewUsers({ period: 'this week', utc: false }), {
120-
legacyRoot: true,
121119
wrapper: mockAppRoot()
122120
.withEndpoint('GET', '/v1/engagement-dashboard/users/new-users', () => expectedResult)
123121
.build(),

apps/meteor/client/views/hooks/useMemberList.spec.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('useMembersList', () => {
8585
debouncedText: '',
8686
roomType: 'c',
8787
}),
88-
{ legacyRoot: true, wrapper: wrapper.build() },
88+
{ wrapper: wrapper.build() },
8989
);
9090

9191
await expect(result.current.isLoading).toBe(true);
@@ -107,7 +107,7 @@ describe('useMembersList', () => {
107107
debouncedText: '',
108108
roomType: 'p',
109109
}),
110-
{ legacyRoot: true, wrapper: wrapper.build() },
110+
{ wrapper: wrapper.build() },
111111
);
112112

113113
expect(result.current.isLoading).toBe(true);
@@ -130,7 +130,7 @@ describe('useMembersList', () => {
130130
debouncedText: '',
131131
roomType: 'd',
132132
}),
133-
{ legacyRoot: true, wrapper: wrapper.build() },
133+
{ wrapper: wrapper.build() },
134134
);
135135

136136
await waitFor(() => expect(result.current.isLoading).toBe(false));
@@ -152,7 +152,6 @@ describe('useMembersList', () => {
152152
roomType: 'c',
153153
}),
154154
{
155-
legacyRoot: true,
156155
wrapper: wrapper
157156
.withEndpoint('GET', '/v1/rooms.membersOrderedByRole', ({ offset }) => {
158157
if (offset === 0) {
@@ -199,7 +198,7 @@ describe('useMembersList', () => {
199198
debouncedText: '',
200199
roomType: 'c',
201200
}),
202-
{ legacyRoot: true, wrapper: wrapper.build() },
201+
{ wrapper: wrapper.build() },
203202
);
204203

205204
await waitFor(() => expect(subscribeMock).toHaveBeenCalledWith('roles-change', expect.any(Function)));
@@ -229,7 +228,7 @@ describe('useMembersList', () => {
229228
debouncedText: '',
230229
roomType: 'c',
231230
}),
232-
{ legacyRoot: true, wrapper: wrapper.build() },
231+
{ wrapper: wrapper.build() },
233232
);
234233

235234
await waitFor(() => expect(result.current.isLoading).toBe(false));
@@ -285,7 +284,6 @@ describe('useMembersList', () => {
285284
roomType: 'c',
286285
}),
287286
{
288-
legacyRoot: true,
289287
wrapper: wrapper.withEndpoint('GET', '/v1/rooms.membersOrderedByRole', (_params) => customPage as any).build(),
290288
},
291289
);
@@ -362,7 +360,7 @@ describe('useMembersList', () => {
362360
debouncedText: '',
363361
roomType: 'c',
364362
}),
365-
{ legacyRoot: true, wrapper: testWrapper.build() },
363+
{ wrapper: testWrapper.build() },
366364
);
367365

368366
// Page 1

apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.spec.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ describe('AppDetailsPage', () => {
6262
it('should not display the Save button initially', async () => {
6363
render(<AppDetailsPage id='app123' />, {
6464
wrapper: wrapper.build(),
65-
legacyRoot: true,
6665
});
6766

6867
await waitFor(() => {
@@ -73,7 +72,6 @@ describe('AppDetailsPage', () => {
7372
it('should display the Save button when a setting is changed', async () => {
7473
render(<AppDetailsPage id='app123' />, {
7574
wrapper: wrapper.build(),
76-
legacyRoot: true,
7775
});
7876

7977
const settingInput = screen.getByLabelText('setting1');
@@ -90,7 +88,6 @@ describe('AppDetailsPage', () => {
9088

9189
render(<AppDetailsPage id='app123' />, {
9290
wrapper: wrapper.build(),
93-
legacyRoot: true,
9491
});
9592

9693
const settingInput = screen.getByLabelText('setting1');
@@ -111,7 +108,6 @@ describe('AppDetailsPage', () => {
111108

112109
render(<AppDetailsPage id='app123' />, {
113110
wrapper: wrapper.build(),
114-
legacyRoot: true,
115111
});
116112

117113
const settingInput = screen.getByLabelText('setting1');
@@ -131,7 +127,6 @@ describe('AppDetailsPage', () => {
131127

132128
render(<AppDetailsPage id='app123' />, {
133129
wrapper: wrapper.build(),
134-
legacyRoot: true,
135130
});
136131

137132
const settingInput = screen.getByLabelText('setting1');

packages/ui-client/src/hooks/useUserDisplayName.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const fakeUser = {
1010

1111
it('should return username if UI_Use_Real_Name setting is false', () => {
1212
const { result } = renderHook(() => useUserDisplayName(fakeUser), {
13-
legacyRoot: true,
1413
wrapper: mockAppRoot().withSetting('UI_Use_Real_Name', false).build(),
1514
});
1615

@@ -19,7 +18,6 @@ it('should return username if UI_Use_Real_Name setting is false', () => {
1918

2019
it('should return name if UI_Use_Real_Name setting is true', () => {
2120
const { result } = renderHook(() => useUserDisplayName(fakeUser), {
22-
legacyRoot: true,
2321
wrapper: mockAppRoot().withSetting('UI_Use_Real_Name', true).build(),
2422
});
2523

@@ -28,7 +26,6 @@ it('should return name if UI_Use_Real_Name setting is true', () => {
2826

2927
it('should return username if UI_Use_Real_Name setting is true and user has no name', () => {
3028
const { result } = renderHook(() => useUserDisplayName({ ...fakeUser, name: undefined }), {
31-
legacyRoot: true,
3229
wrapper: mockAppRoot().withSetting('UI_Use_Real_Name', true).build(),
3330
});
3431

0 commit comments

Comments
 (0)