EnxDev commented on code in PR #45337:
URL: https://github.com/apache/superset/pull/45337#discussion_r4296023850
##########
superset-frontend/src/pages/ActionLog/ActionLog.test.tsx:
##########
@@ -88,3 +88,56 @@ test('sorting by Action sends order_column=action as a
positive control', async
).toBe(true),
);
});
+
+test('JSON column opens a tree modal for object payloads', async () => {
+ fetchMock.removeRoutes();
+ fetchMock.get('glob:*/api/v1/log/_info*', { permissions: ['can_read'] });
+ fetchMock.get(logEndpoint, {
+ result: [{ ...mockLogs[0], json: '{"path":"/superset/welcome/","n":1}' }],
+ count: 1,
+ });
+ renderActionLog();
+
+ await userEvent.click(
+ await screen.findByText('{"path":"/superset/welcome/","n":1}'),
+ );
+
+ const dialog = await screen.findByRole('dialog');
+ expect(dialog).toHaveTextContent('path');
Review Comment:
You're right, `toHaveTextContent` on the dialog would match a single string
leaf just as well. The test now checks the tree's separate nodes: the `path:`
and `n:` key labels, plus the `"/superset/welcome/"` and `1` value nodes. To
confirm it actually pins the behavior, I temporarily passed `jsonObject={json}`
(the raw string) in the column renderer. The test failed with "Unable to find
an element with the text: path:" and passed again once I reverted that. Fixed
in 89760b2.
--
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]