Skip to content

Commit

Permalink
Fix imports to properly collect coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Levko Kravets <[email protected]>
  • Loading branch information
kravets-levko committed Apr 23, 2024
1 parent bbf35d6 commit 4180896
Show file tree
Hide file tree
Showing 54 changed files with 104 additions and 107 deletions.
8 changes: 4 additions & 4 deletions tests/e2e/arrow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const { expect } = require('chai');
const sinon = require('sinon');
const config = require('./utils/config');
const logger = require('./utils/logger')(config.logger);
const { DBSQLClient } = require('../..');
const ArrowResultHandler = require('../../dist/result/ArrowResultHandler').default;
const ArrowResultConverter = require('../../dist/result/ArrowResultConverter').default;
const ResultSlicer = require('../../dist/result/ResultSlicer').default;
const { DBSQLClient } = require('../../lib');
const ArrowResultHandler = require('../../lib/result/ArrowResultHandler').default;
const ArrowResultConverter = require('../../lib/result/ArrowResultConverter').default;
const ResultSlicer = require('../../lib/result/ResultSlicer').default;

const fixtures = require('../fixtures/compatibility');
const { expected: expectedColumn } = require('../fixtures/compatibility/column');
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/batched_fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { expect } = require('chai');
const sinon = require('sinon');
const config = require('./utils/config');
const logger = require('./utils/logger')(config.logger);
const { DBSQLClient } = require('../..');
const { DBSQLClient } = require('../../lib');

async function openSession(customConfig) {
const client = new DBSQLClient();
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/cloudfetch.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { expect } = require('chai');
const sinon = require('sinon');
const config = require('./utils/config');
const { DBSQLClient } = require('../..');
const CloudFetchResultHandler = require('../../dist/result/CloudFetchResultHandler').default;
const ArrowResultConverter = require('../../dist/result/ArrowResultConverter').default;
const ResultSlicer = require('../../dist/result/ResultSlicer').default;
const { DBSQLClient } = require('../../lib');
const CloudFetchResultHandler = require('../../lib/result/CloudFetchResultHandler').default;
const ArrowResultConverter = require('../../lib/result/ArrowResultConverter').default;
const ResultSlicer = require('../../lib/result/ResultSlicer').default;

async function openSession(customConfig) {
const client = new DBSQLClient();
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/data_types.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { expect } = require('chai');
const sinon = require('sinon');
const config = require('./utils/config');
const logger = require('./utils/logger')(config.logger);
const { DBSQLClient } = require('../..');
const { DBSQLClient } = require('../../lib');

async function openSession(customConfig) {
const client = new DBSQLClient();
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/proxy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const sinon = require('sinon');
const httpProxy = require('http-proxy');
const https = require('https');
const config = require('./utils/config');
const { DBSQLClient } = require('../..');
const { DBSQLClient } = require('../../lib');

class HttpProxyMock {
constructor(target, port) {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/query_parameters.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { expect, AssertionError } = require('chai');
const Int64 = require('node-int64');
const config = require('./utils/config');
const { DBSQLClient, DBSQLParameter, DBSQLParameterType } = require('../..');
const ParameterError = require('../../dist/errors/ParameterError').default;
const { DBSQLClient, DBSQLParameter, DBSQLParameterType } = require('../../lib');
const ParameterError = require('../../lib/errors/ParameterError').default;

const openSession = async () => {
const client = new DBSQLClient();
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/staging_ingestion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path');
const os = require('os');
const uuid = require('uuid');
const config = require('./utils/config');
const { DBSQLClient } = require('../..');
const StagingError = require('../../dist/errors/StagingError').default;
const { DBSQLClient } = require('../../lib');
const StagingError = require('../../lib/errors/StagingError').default;

describe('Staging Test', () => {
const catalog = config.database[0];
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/timeouts.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const config = require('./utils/config');
const { DBSQLClient } = require('../..');
const { DBSQLClient } = require('../../lib');

async function openSession(socketTimeout, customConfig) {
const client = new DBSQLClient();
Expand Down
15 changes: 6 additions & 9 deletions tests/unit/DBSQLClient.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const DBSQLClient = require('../../dist/DBSQLClient').default;
const DBSQLSession = require('../../dist/DBSQLSession').default;
const DBSQLClient = require('../../lib/DBSQLClient').default;
const DBSQLSession = require('../../lib/DBSQLSession').default;

const PlainHttpAuthentication = require('../../dist/connection/auth/PlainHttpAuthentication').default;
const DatabricksOAuth = require('../../dist/connection/auth/DatabricksOAuth').default;
const {
DatabricksOAuthManager,
AzureOAuthManager,
} = require('../../dist/connection/auth/DatabricksOAuth/OAuthManager');
const PlainHttpAuthentication = require('../../lib/connection/auth/PlainHttpAuthentication').default;
const DatabricksOAuth = require('../../lib/connection/auth/DatabricksOAuth').default;
const { DatabricksOAuthManager, AzureOAuthManager } = require('../../lib/connection/auth/DatabricksOAuth/OAuthManager');

const HttpConnectionModule = require('../../dist/connection/connections/HttpConnection');
const HttpConnectionModule = require('../../lib/connection/connections/HttpConnection');

const { default: HttpConnection } = HttpConnectionModule;

Expand Down
20 changes: 10 additions & 10 deletions tests/unit/DBSQLOperation.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const { DBSQLLogger, LogLevel } = require('../../dist');
const { DBSQLLogger, LogLevel } = require('../../lib');
const { TStatusCode, TOperationState, TTypeId, TSparkRowSetType } = require('../../thrift/TCLIService_types');
const DBSQLOperation = require('../../dist/DBSQLOperation').default;
const StatusError = require('../../dist/errors/StatusError').default;
const OperationStateError = require('../../dist/errors/OperationStateError').default;
const HiveDriverError = require('../../dist/errors/HiveDriverError').default;
const JsonResultHandler = require('../../dist/result/JsonResultHandler').default;
const ArrowResultConverter = require('../../dist/result/ArrowResultConverter').default;
const ArrowResultHandler = require('../../dist/result/ArrowResultHandler').default;
const CloudFetchResultHandler = require('../../dist/result/CloudFetchResultHandler').default;
const ResultSlicer = require('../../dist/result/ResultSlicer').default;
const DBSQLOperation = require('../../lib/DBSQLOperation').default;
const StatusError = require('../../lib/errors/StatusError').default;
const OperationStateError = require('../../lib/errors/OperationStateError').default;
const HiveDriverError = require('../../lib/errors/HiveDriverError').default;
const JsonResultHandler = require('../../lib/result/JsonResultHandler').default;
const ArrowResultConverter = require('../../lib/result/ArrowResultConverter').default;
const ArrowResultHandler = require('../../lib/result/ArrowResultHandler').default;
const CloudFetchResultHandler = require('../../lib/result/CloudFetchResultHandler').default;
const ResultSlicer = require('../../lib/result/ResultSlicer').default;

class OperationHandleMock {
constructor(hasResultSet = true) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/DBSQLParameter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { expect } = require('chai');

const Int64 = require('node-int64');
const { TSparkParameterValue, TSparkParameter } = require('../../thrift/TCLIService_types');
const { DBSQLParameter, DBSQLParameterType } = require('../../dist/DBSQLParameter');
const { DBSQLParameter, DBSQLParameterType } = require('../../lib/DBSQLParameter');

describe('DBSQLParameter', () => {
it('should infer types correctly', () => {
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/DBSQLSession.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { expect, AssertionError } = require('chai');
const { DBSQLLogger, LogLevel } = require('../../dist');
const { DBSQLLogger, LogLevel } = require('../../lib');
const sinon = require('sinon');
const DBSQLSession = require('../../dist/DBSQLSession').default;
const InfoValue = require('../../dist/dto/InfoValue').default;
const Status = require('../../dist/dto/Status').default;
const DBSQLOperation = require('../../dist/DBSQLOperation').default;
const HiveDriver = require('../../dist/hive/HiveDriver').default;
const DBSQLClient = require('../../dist/DBSQLClient').default;
const DBSQLSession = require('../../lib/DBSQLSession').default;
const InfoValue = require('../../lib/dto/InfoValue').default;
const Status = require('../../lib/dto/Status').default;
const DBSQLOperation = require('../../lib/DBSQLOperation').default;
const HiveDriver = require('../../lib/hive/HiveDriver').default;
const DBSQLClient = require('../../lib/DBSQLClient').default;

// Create logger that won't emit
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const { expect, AssertionError } = require('chai');
const { EventEmitter } = require('events');
const sinon = require('sinon');
const http = require('http');
const { DBSQLLogger, LogLevel } = require('../../../../../dist');
const AuthorizationCode = require('../../../../../dist/connection/auth/DatabricksOAuth/AuthorizationCode').default;
const { DBSQLLogger, LogLevel } = require('../../../../../lib');
const AuthorizationCode = require('../../../../../lib/connection/auth/DatabricksOAuth/AuthorizationCode').default;

const logger = new DBSQLLogger({ level: LogLevel.error });

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/connection/auth/DatabricksOAuth/OAuthManager.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const openidClientLib = require('openid-client');
const { DBSQLLogger, LogLevel } = require('../../../../../dist');
const { DBSQLLogger, LogLevel } = require('../../../../../lib');
const {
DatabricksOAuthManager,
AzureOAuthManager,
OAuthFlow,
} = require('../../../../../dist/connection/auth/DatabricksOAuth/OAuthManager');
const OAuthToken = require('../../../../../dist/connection/auth/DatabricksOAuth/OAuthToken').default;
const { OAuthScope, scopeDelimiter } = require('../../../../../dist/connection/auth/DatabricksOAuth/OAuthScope');
const AuthorizationCodeModule = require('../../../../../dist/connection/auth/DatabricksOAuth/AuthorizationCode');
} = require('../../../../../lib/connection/auth/DatabricksOAuth/OAuthManager');
const OAuthToken = require('../../../../../lib/connection/auth/DatabricksOAuth/OAuthToken').default;
const { OAuthScope, scopeDelimiter } = require('../../../../../lib/connection/auth/DatabricksOAuth/OAuthScope');
const AuthorizationCodeModule = require('../../../../../lib/connection/auth/DatabricksOAuth/AuthorizationCode');

const { createValidAccessToken, createExpiredAccessToken } = require('./utils');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { expect } = require('chai');
const OAuthToken = require('../../../../../dist/connection/auth/DatabricksOAuth/OAuthToken').default;
const OAuthToken = require('../../../../../lib/connection/auth/DatabricksOAuth/OAuthToken').default;

const { createAccessToken } = require('./utils');

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/connection/auth/DatabricksOAuth/index.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const DatabricksOAuth = require('../../../../../dist/connection/auth/DatabricksOAuth/index').default;
const OAuthToken = require('../../../../../dist/connection/auth/DatabricksOAuth/OAuthToken').default;
const OAuthManager = require('../../../../../dist/connection/auth/DatabricksOAuth/OAuthManager').default;
const DatabricksOAuth = require('../../../../../lib/connection/auth/DatabricksOAuth/index').default;
const OAuthToken = require('../../../../../lib/connection/auth/DatabricksOAuth/OAuthToken').default;
const OAuthManager = require('../../../../../lib/connection/auth/DatabricksOAuth/OAuthManager').default;

const { createValidAccessToken, createExpiredAccessToken } = require('./utils');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/connection/auth/PlainHttpAuthentication.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { expect } = require('chai');
const PlainHttpAuthentication = require('../../../../dist/connection/auth/PlainHttpAuthentication').default;
const PlainHttpAuthentication = require('../../../../lib/connection/auth/PlainHttpAuthentication').default;

describe('PlainHttpAuthentication', () => {
it('username and password must be anonymous if nothing passed', () => {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/connection/connections/HttpConnection.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const http = require('http');
const { expect } = require('chai');
const HttpConnection = require('../../../../dist/connection/connections/HttpConnection').default;
const ThriftHttpConnection = require('../../../../dist/connection/connections/ThriftHttpConnection').default;
const DBSQLClient = require('../../../../dist/DBSQLClient').default;
const HttpConnection = require('../../../../lib/connection/connections/HttpConnection').default;
const ThriftHttpConnection = require('../../../../lib/connection/connections/ThriftHttpConnection').default;
const DBSQLClient = require('../../../../lib/DBSQLClient').default;

describe('HttpConnection.connect', () => {
it('should create Thrift connection', async () => {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/connection/connections/HttpRetryPolicy.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const { Request, Response } = require('node-fetch');
const HttpRetryPolicy = require('../../../../dist/connection/connections/HttpRetryPolicy').default;
const { default: RetryError, RetryErrorCode } = require('../../../../dist/errors/RetryError');
const DBSQLClient = require('../../../../dist/DBSQLClient').default;
const HttpRetryPolicy = require('../../../../lib/connection/connections/HttpRetryPolicy').default;
const { default: RetryError, RetryErrorCode } = require('../../../../lib/errors/RetryError');
const DBSQLClient = require('../../../../lib/DBSQLClient').default;

class ClientContextMock {
constructor(configOverrides) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/connection/connections/NullRetryPolicy.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { expect, AssertionError } = require('chai');
const sinon = require('sinon');
const NullRetryPolicy = require('../../../../dist/connection/connections/NullRetryPolicy').default;
const NullRetryPolicy = require('../../../../lib/connection/connections/NullRetryPolicy').default;

describe('NullRetryPolicy', () => {
it('should never allow retries', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/dto/InfoValue.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { expect } = require('chai');
const InfoValue = require('../../../dist/dto/InfoValue').default;
const InfoValue = require('../../../lib/dto/InfoValue').default;
const NodeInt64 = require('node-int64');

const createInfoValueMock = (value) =>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/dto/Status.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { expect } = require('chai');
const { TCLIService_types } = require('../../../').thrift;
const Status = require('../../../dist/dto/Status').default;
const { TCLIService_types } = require('../../../lib').thrift;
const Status = require('../../../lib/dto/Status').default;

describe('StatusFactory', () => {
it('should be success', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/hive/HiveDriver.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const { TCLIService_types } = require('../../../').thrift;
const HiveDriver = require('../../../dist/hive/HiveDriver').default;
const { TCLIService_types } = require('../../../lib').thrift;
const HiveDriver = require('../../../lib/hive/HiveDriver').default;

const toTitleCase = (str) => str[0].toUpperCase() + str.slice(1);

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/hive/commands/BaseCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { expect, AssertionError } = require('chai');
const { Request, Response } = require('node-fetch');
const { Thrift } = require('thrift');
const HiveDriverError = require('../../../../dist/errors/HiveDriverError').default;
const BaseCommand = require('../../../../dist/hive/Commands/BaseCommand').default;
const HttpRetryPolicy = require('../../../../dist/connection/connections/HttpRetryPolicy').default;
const DBSQLClient = require('../../../../dist/DBSQLClient').default;
const HiveDriverError = require('../../../../lib/errors/HiveDriverError').default;
const BaseCommand = require('../../../../lib/hive/Commands/BaseCommand').default;
const HttpRetryPolicy = require('../../../../lib/connection/connections/HttpRetryPolicy').default;
const DBSQLClient = require('../../../../lib/DBSQLClient').default;

class ThriftClientMock {
constructor(context, methodHandler) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const CancelDelegationTokenCommand = require('../../../../dist/hive/Commands/CancelDelegationTokenCommand').default;
const CancelDelegationTokenCommand = require('../../../../lib/hive/Commands/CancelDelegationTokenCommand').default;

const requestMock = {
sessionHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/CancelOperationCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const CancelOperationCommand = require('../../../../dist/hive/Commands/CancelOperationCommand').default;
const CancelOperationCommand = require('../../../../lib/hive/Commands/CancelOperationCommand').default;

const requestMock = {
operationHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/CloseOperationCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const CloseOperationCommand = require('../../../../dist/hive/Commands/CloseOperationCommand').default;
const CloseOperationCommand = require('../../../../lib/hive/Commands/CloseOperationCommand').default;

const requestMock = {
operationHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/CloseSessionCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const CloseSessionCommand = require('../../../../dist/hive/Commands/CloseSessionCommand').default;
const CloseSessionCommand = require('../../../../lib/hive/Commands/CloseSessionCommand').default;

const responseMock = {
status: { statusCode: 0 },
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/ExecuteStatementCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const ExecuteStatementCommand = require('../../../../dist/hive/Commands/ExecuteStatementCommand').default;
const ExecuteStatementCommand = require('../../../../lib/hive/Commands/ExecuteStatementCommand').default;

const requestMock = {
sessionHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/FetchResultsCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const FetchResultsCommand = require('../../../../dist/hive/Commands/FetchResultsCommand').default;
const FetchResultsCommand = require('../../../../lib/hive/Commands/FetchResultsCommand').default;

const requestMock = {
operationHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/GetCatalogsCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const GetCatalogsCommand = require('../../../../dist/hive/Commands/GetCatalogsCommand').default;
const GetCatalogsCommand = require('../../../../lib/hive/Commands/GetCatalogsCommand').default;

const requestMock = {
sessionHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/GetColumnsCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const GetColumnsCommand = require('../../../../dist/hive/Commands/GetColumnsCommand').default;
const GetColumnsCommand = require('../../../../lib/hive/Commands/GetColumnsCommand').default;

const requestMock = {
sessionHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/GetCrossReferenceCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const GetCrossReferenceCommand = require('../../../../dist/hive/Commands/GetCrossReferenceCommand').default;
const GetCrossReferenceCommand = require('../../../../lib/hive/Commands/GetCrossReferenceCommand').default;

const requestMock = {
sessionHandle: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/hive/commands/GetDelegationTokenCommand.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai');
const sinon = require('sinon');
const TCLIService_types = require('../../../../thrift/TCLIService_types');
const GetDelegationTokenCommand = require('../../../../dist/hive/Commands/GetDelegationTokenCommand').default;
const GetDelegationTokenCommand = require('../../../../lib/hive/Commands/GetDelegationTokenCommand').default;

const requestMock = {
sessionHandle: {
Expand Down
Loading

0 comments on commit 4180896

Please sign in to comment.