chore: Remove outdated `legacyRoot` param from unit tests (#36632)

pull/36644/head
Douglas Fabris 5 months ago committed by GitHub
parent dc6acda84b
commit 0153ea2b2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 26
      apps/meteor/client/components/GazzodownText.spec.tsx
  2. 6
      apps/meteor/client/components/message/variants/SystemMessage.spec.tsx
  3. 1
      apps/meteor/client/hooks/useUserCustomFields.spec.tsx
  4. 2
      apps/meteor/client/views/admin/engagementDashboard/messages/useMessagesSent.spec.ts
  5. 2
      apps/meteor/client/views/admin/engagementDashboard/users/useHourlyChatActivity.spec.ts
  6. 2
      apps/meteor/client/views/admin/engagementDashboard/users/useNewUsers.spec.ts
  7. 14
      apps/meteor/client/views/hooks/useMemberList.spec.tsx
  8. 5
      apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.spec.tsx
  9. 3
      packages/ui-client/src/hooks/useUserDisplayName.spec.ts

@ -50,7 +50,7 @@ describe('GazzodownText highlights', () => {
<GazzodownText>
<HighlightTester text='Это тест сообщения' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
// Expect that the highlighted element wraps exactly "тест"
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^тест$/i);
@ -63,7 +63,7 @@ describe('GazzodownText highlights', () => {
<GazzodownText>
<HighlightTester text='Тест сообщения' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^тест$/i);
});
@ -75,7 +75,7 @@ describe('GazzodownText highlights', () => {
<GazzodownText>
<HighlightTester text='Тестирование сообщения' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(screen.queryByTitle('Highlighted_chosen_word')).not.toBeInTheDocument();
});
@ -87,7 +87,7 @@ describe('GazzodownText highlights', () => {
<GazzodownText>
<HighlightTester text='Сообщение тест' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^тест$/i);
});
@ -99,7 +99,7 @@ describe('GazzodownText highlights', () => {
<GazzodownText>
<HighlightTester text='This is a test message' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
});
@ -111,7 +111,7 @@ describe('GazzodownText highlights', () => {
<GazzodownText>
<HighlightTester text='test is at the beginning, in the middle test, and at the end test' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
const highlightedElements = screen.getAllByTitle('Highlighted_chosen_word');
// Expect three separate highlights.
@ -133,7 +133,7 @@ in it.`;
<GazzodownText>
<HighlightTester text={multilineText} />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
const highlightedElements = screen.getAllByTitle('Highlighted_chosen_word');
// At least two occurrences are expected: one for "Test" (capitalized) and one for "test"
@ -151,7 +151,7 @@ in it.`;
<GazzodownText>
<HighlightTester text='This is :test: inside colons' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
// The highlighted element should contain only "test"
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
@ -164,7 +164,7 @@ in it.`;
<GazzodownText>
<HighlightTester text='This is :test with colon at the start' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
// The highlighted element should contain only "test"
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
@ -177,7 +177,7 @@ in it.`;
<GazzodownText>
<HighlightTester text='This is test: with colon at end' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
// The highlighted element should contain only "test"
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
@ -190,7 +190,7 @@ in it.`;
<GazzodownText>
<HighlightTester text='This test message should highlight the word highlight in multiple places: test and highlight.' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
const highlightedElements = screen.getAllByTitle('Highlighted_chosen_word');
@ -209,7 +209,7 @@ in it.`;
<GazzodownText>
<HighlightTester text={testText} />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^te-st_te\.st\/te=te!st:$/i);
@ -222,7 +222,7 @@ in it.`;
<GazzodownText>
<HighlightTester text='This is a test message' />
</GazzodownText>,
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(screen.getByTitle('Highlighted_chosen_word')).toHaveTextContent(/^test$/i);
});

@ -56,7 +56,7 @@ describe('SystemMessage', () => {
it('should render system message', () => {
const message = createBaseMessage('& test &');
render(<SystemMessage message={message} showUserAvatar />, { legacyRoot: true, wrapper: wrapper.build() });
render(<SystemMessage message={message} showUserAvatar />, { wrapper: wrapper.build() });
expect(screen.getByText('changed room description to: & test &')).toBeInTheDocument();
});
@ -64,7 +64,7 @@ describe('SystemMessage', () => {
it('should not show escaped html while rendering system message', () => {
const message = createBaseMessage('& test &');
render(<SystemMessage message={message} showUserAvatar />, { legacyRoot: true, wrapper: wrapper.build() });
render(<SystemMessage message={message} showUserAvatar />, { wrapper: wrapper.build() });
expect(screen.getByText('changed room description to: & test &')).toBeInTheDocument();
expect(screen.queryByText('changed room description to: &amp; test &amp;')).not.toBeInTheDocument();
@ -73,7 +73,7 @@ describe('SystemMessage', () => {
it('should not inject html', () => {
const message = createBaseMessage('<button title="test-title">OK</button>');
render(<SystemMessage message={message} showUserAvatar />, { legacyRoot: true, wrapper: wrapper.build() });
render(<SystemMessage message={message} showUserAvatar />, { wrapper: wrapper.build() });
expect(screen.queryByTitle('test-title')).not.toBeInTheDocument();
expect(screen.getByText('changed room description to: <button title="test-title">OK</button>')).toBeInTheDocument();

@ -10,7 +10,6 @@ it('should not break with invalid Accounts_CustomFieldsToShowInUserInfo setting'
prop: 'value',
}),
{
legacyRoot: true,
wrapper: mockAppRoot()
.withSetting('Accounts_CustomFieldsToShowInUserInfo', '{"Invalid": "Object", "InvalidProperty": "Invalid" }')
.build(),

@ -56,7 +56,6 @@ it('should return utc time', async () => {
},
};
const { result } = renderHook(() => useMessagesSent({ period: 'this week', utc: true }), {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/engagement-dashboard/messages/messages-sent', () => expectedResult)
.build(),
@ -117,7 +116,6 @@ it.skip('should return local time', async () => {
},
};
const { result } = renderHook(() => useMessagesSent({ period: 'this week', utc: false }), {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/engagement-dashboard/messages/messages-sent', () => expectedResult)
.build(),

@ -22,7 +22,6 @@ it('should return utc time', async () => {
success: true,
};
const { result } = renderHook(() => useHourlyChatActivity({ displacement: 0, utc: true }), {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/engagement-dashboard/users/chat-busier/hourly-data', () => expectedResult)
.build(),
@ -76,7 +75,6 @@ it.skip('should return local time', async () => {
};
const { result } = renderHook(() => useHourlyChatActivity({ displacement: 0, utc: false }), {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/engagement-dashboard/users/chat-busier/hourly-data', () => receivedData)
.build(),

@ -56,7 +56,6 @@ it('should return utc time', async () => {
},
};
const { result } = renderHook(() => useNewUsers({ period: 'this week', utc: true }), {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/engagement-dashboard/users/new-users', () => expectedResult)
.build(),
@ -117,7 +116,6 @@ it.skip('should return local time', async () => {
},
};
const { result } = renderHook(() => useNewUsers({ period: 'this week', utc: false }), {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/engagement-dashboard/users/new-users', () => expectedResult)
.build(),

@ -85,7 +85,7 @@ describe('useMembersList', () => {
debouncedText: '',
roomType: 'c',
}),
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
await expect(result.current.isLoading).toBe(true);
@ -107,7 +107,7 @@ describe('useMembersList', () => {
debouncedText: '',
roomType: 'p',
}),
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
expect(result.current.isLoading).toBe(true);
@ -130,7 +130,7 @@ describe('useMembersList', () => {
debouncedText: '',
roomType: 'd',
}),
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
await waitFor(() => expect(result.current.isLoading).toBe(false));
@ -152,7 +152,6 @@ describe('useMembersList', () => {
roomType: 'c',
}),
{
legacyRoot: true,
wrapper: wrapper
.withEndpoint('GET', '/v1/rooms.membersOrderedByRole', ({ offset }) => {
if (offset === 0) {
@ -199,7 +198,7 @@ describe('useMembersList', () => {
debouncedText: '',
roomType: 'c',
}),
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
await waitFor(() => expect(subscribeMock).toHaveBeenCalledWith('roles-change', expect.any(Function)));
@ -229,7 +228,7 @@ describe('useMembersList', () => {
debouncedText: '',
roomType: 'c',
}),
{ legacyRoot: true, wrapper: wrapper.build() },
{ wrapper: wrapper.build() },
);
await waitFor(() => expect(result.current.isLoading).toBe(false));
@ -285,7 +284,6 @@ describe('useMembersList', () => {
roomType: 'c',
}),
{
legacyRoot: true,
wrapper: wrapper.withEndpoint('GET', '/v1/rooms.membersOrderedByRole', (_params) => customPage as any).build(),
},
);
@ -362,7 +360,7 @@ describe('useMembersList', () => {
debouncedText: '',
roomType: 'c',
}),
{ legacyRoot: true, wrapper: testWrapper.build() },
{ wrapper: testWrapper.build() },
);
// Page 1

@ -62,7 +62,6 @@ describe('AppDetailsPage', () => {
it('should not display the Save button initially', async () => {
render(<AppDetailsPage id='app123' />, {
wrapper: wrapper.build(),
legacyRoot: true,
});
await waitFor(() => {
@ -73,7 +72,6 @@ describe('AppDetailsPage', () => {
it('should display the Save button when a setting is changed', async () => {
render(<AppDetailsPage id='app123' />, {
wrapper: wrapper.build(),
legacyRoot: true,
});
const settingInput = screen.getByLabelText('setting1');
@ -90,7 +88,6 @@ describe('AppDetailsPage', () => {
render(<AppDetailsPage id='app123' />, {
wrapper: wrapper.build(),
legacyRoot: true,
});
const settingInput = screen.getByLabelText('setting1');
@ -111,7 +108,6 @@ describe('AppDetailsPage', () => {
render(<AppDetailsPage id='app123' />, {
wrapper: wrapper.build(),
legacyRoot: true,
});
const settingInput = screen.getByLabelText('setting1');
@ -131,7 +127,6 @@ describe('AppDetailsPage', () => {
render(<AppDetailsPage id='app123' />, {
wrapper: wrapper.build(),
legacyRoot: true,
});
const settingInput = screen.getByLabelText('setting1');

@ -10,7 +10,6 @@ const fakeUser = {
it('should return username if UI_Use_Real_Name setting is false', () => {
const { result } = renderHook(() => useUserDisplayName(fakeUser), {
legacyRoot: true,
wrapper: mockAppRoot().withSetting('UI_Use_Real_Name', false).build(),
});
@ -19,7 +18,6 @@ it('should return username if UI_Use_Real_Name setting is false', () => {
it('should return name if UI_Use_Real_Name setting is true', () => {
const { result } = renderHook(() => useUserDisplayName(fakeUser), {
legacyRoot: true,
wrapper: mockAppRoot().withSetting('UI_Use_Real_Name', true).build(),
});
@ -28,7 +26,6 @@ it('should return name if UI_Use_Real_Name setting is true', () => {
it('should return username if UI_Use_Real_Name setting is true and user has no name', () => {
const { result } = renderHook(() => useUserDisplayName({ ...fakeUser, name: undefined }), {
legacyRoot: true,
wrapper: mockAppRoot().withSetting('UI_Use_Real_Name', true).build(),
});

Loading…
Cancel
Save