suddjian commented on code in PR #20261:
URL: https://github.com/apache/superset/pull/20261#discussion_r899651185
##########
superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts:
##########
@@ -605,4 +605,114 @@ describe('SupersetClientClass', () => {
}
});
});
+
+ describe('.postForm()', () => {
+ const protocol = 'https:';
+ const host = 'host';
+ const mockPostFormEndpoint = '/post_form/url';
+ const mockPostFormUrl = `${protocol}//${host}${mockPostFormEndpoint}`;
+ const guestToken = 'test-guest-token';
+ const postFormPayload = { number: 123, array: [1, 2, 3] };
+
+ it('makes postForm request', async () => {
+ const client = new SupersetClientClass({ protocol, host });
+ await client.init();
+
+ const createElement = jest.fn(() => ({
+ appendChild: jest.fn(),
+ submit: jest.fn(),
+ }));
+
+ document.createElement = createElement as any;
+ const appendChild = jest.fn();
+ const removeChild = jest.fn();
+ document.body.appendChild = appendChild;
+ document.body.removeChild = removeChild;
Review Comment:
This setup is duplicated a lot. Can we consolidate this, maybe in a
`beforeEach` function? Also we are missing cleanup of these mocks.
--
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]