sadpandajoe commented on code in PR #45640:
URL: https://github.com/apache/superset/pull/45640#discussion_r4407569900
##########
superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ImageLoader.test.tsx:
##########
@@ -63,12 +64,26 @@ describe('ImageLoader', () => {
'src',
'/fallback',
);
+ expect(await screen.findByTestId('image-loader')).toHaveAttribute(
+ 'src',
+ '/local_url',
+ );
expect(fetchMock.callHistory.calls(/thumbnail/)).toHaveLength(1);
expect(global.URL.createObjectURL).toHaveBeenCalled();
+ });
+
+ test('requests src through SupersetClient', async () => {
+ const getSpy = jest.spyOn(SupersetClient, 'get');
Review Comment:
This test only shows that `ImageLoader` calls `SupersetClient.get` with
`/thumbnail`. It never configures an `appRoot`, and the `glob:*/thumbnail` mock
matches both `/analytics/thumbnail` and `/thumbnail`. If the endpoint were
later requested without the app root again, which is exactly the bug this PR
fixes, every test here would still pass. Could you configure the client with
`appRoot: '/analytics'`, mock only the prefixed URL, and assert that request is
made?
--
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]