sadpandajoe commented on code in PR #33946:
URL: https://github.com/apache/superset/pull/33946#discussion_r3693509400
##########
superset-frontend/src/pages/Home/Home.test.tsx:
##########
@@ -137,7 +140,23 @@ const mockedPropsWithoutSqlRole = {
...mockedProps,
user: {
...mockedProps.user,
- roles: {},
+ roles: {
Review Comment:
This fixture now satisfies `WelcomeProps`, so the three existing
`@ts-expect-error` directives below are unused and `lint-frontend` fails with
TS2578 even after fixing the fetch-mock calls. Can we remove those stale
directives with this fixture change?
##########
superset-frontend/src/pages/Home/Home.test.tsx:
##########
@@ -220,6 +239,31 @@ test('Without sql role - calls api methods in parallel on
page load', async () =
expect(fetchMock.callHistory.calls(dashboardsEndpoint)).toHaveLength(2);
});
+test('Without chart role - renders', async () => {
+ /*
+ We ignore the ts error here because the type does not recognize the absence
of a role entry
+ */
+ // @ts-ignore-next-line
+ await renderWelcome(mockedPropsWithoutChartWriteRole);
+ expect(await screen.findByText('Dashboards')).toBeInTheDocument();
+});
+
+test('Without chart role - renders all panels on the page on page load', async
() => {
+ // @ts-ignore-next-line
+ await renderWelcome(mockedPropsWithoutChartWriteRole);
+ const panels = await screen.findAllByText(/Dashboards|Recents|Saved
queries/);
Review Comment:
This test still passes if the Charts panel renders, because the regex never
matches `Charts` and only counts the other three headings. Can we assert that
`queryByText('Charts')` is absent so the permission-gating behavior is actually
covered?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]