Selaa lähdekoodia

[frontend] Fix failing tests and lint issues related to SQL scratchpad and new API URLs

Johan Åhlén 4 vuotta sitten
vanhempi
commit
18c4d3b70c

+ 0 - 1
desktop/core/src/desktop/js/apps/editor/components/sqlScratchpad/SqlScratchpad.vue

@@ -58,7 +58,6 @@
   import { SqlReferenceProvider } from 'sql/reference/types';
 
   import './SqlScratchpad.scss';
-  import defer from '../../../../utils/timing/defer';
   import AceEditor from '../aceEditor/AceEditor.vue';
   import { ActiveStatementChangedEventDetails } from '../aceEditor/types';
   import ExecutableProgressBar from '../ExecutableProgressBar.vue';

+ 1 - 2
desktop/core/src/desktop/js/apps/editor/execution/sessionManager.test.ts

@@ -15,7 +15,6 @@
 // limitations under the License.
 
 import { CancellablePromise } from 'api/cancellablePromise';
-import { CLOSE_SESSION_API } from 'api/urls';
 import { AuthRequest, Session, SessionProperty } from './api';
 
 import * as ExecutionApi from './api';
@@ -145,7 +144,7 @@ describe('sessionManager.ts', () => {
           session.session_id
         );
         expect(options && options.silenceErrors).toBeTruthy();
-        expect(url).toEqual(CLOSE_SESSION_API);
+        expect(url).toContain('/close_session');
         return new CancellablePromise(resolve => {
           resolve();
         });

+ 5 - 6
desktop/core/src/desktop/js/apps/editor/execution/sqlExecutable.test.ts

@@ -15,7 +15,6 @@
 // limitations under the License.
 
 import { CancellablePromise } from 'api/cancellablePromise';
-import { CHECK_STATUS_API, CREATE_SESSION_API, EXECUTE_API_PREFIX, GET_LOGS_API } from 'api/urls';
 
 import Executor from 'apps/editor/execution/executor';
 import SqlExecutable from './sqlExecutable';
@@ -103,14 +102,14 @@ describe('sqlExecutable.js', () => {
     jest.spyOn(ApiUtils, 'post').mockImplementation(
       (url: string): CancellablePromise<unknown> => {
         currentApiHit++;
-        if (url.indexOf(CREATE_SESSION_API) !== -1) {
+        if (url.indexOf('/create_session') !== -1) {
           createSessionApiHit = currentApiHit;
           return new CancellablePromise<unknown>(resolve => {
             resolve({ session: { type: 'foo' } });
           });
-        } else if (url.indexOf(EXECUTE_API_PREFIX) !== -1) {
+        } else if (url.indexOf('/execute') !== -1) {
           executeApiHit = currentApiHit;
-          expect(url).toEqual(EXECUTE_API_PREFIX + 'impala');
+          expect(url).toContain('/execute/impala');
           return new CancellablePromise<unknown>(resolve => {
             resolve({
               handle: {},
@@ -119,11 +118,11 @@ describe('sqlExecutable.js', () => {
               history_parent_uuid: 'some_history_parent_uuid'
             });
           });
-        } else if (url.indexOf(CHECK_STATUS_API) !== -1) {
+        } else if (url.indexOf('/check_status') !== -1) {
           checkStatusApiHit = currentApiHit;
           statusResolve({ query_status: { status: ExecutionStatus.available } });
           return statusPromise;
-        } else if (url.indexOf(GET_LOGS_API) !== -1) {
+        } else if (url.indexOf('/get_logs') !== -1) {
           getLogsApiHit = currentApiHit;
           logsResolve({ status: 0, logs: '' });
           return logsPromise;