From 989eaec6323fb73e96f0f082dc3dc4facde64def Mon Sep 17 00:00:00 2001 From: Sourabh Jain Date: Fri, 11 Apr 2025 16:15:25 +0530 Subject: [PATCH] moved files --- .../AbstractShellHandler.test.tsx | 2 +- .../CassandraShellHandler.test.tsx | 8 +++---- .../MongoShellHandler.test.tsx | 10 ++++----- .../PostgresShellHandler.test.tsx | 22 +++++++++---------- .../{__tests__ => }/ShellTypeFactory.test.tsx | 20 ++++++++--------- .../VCoreMongoShellHandler.test.tsx | 4 ++-- 6 files changed, 33 insertions(+), 33 deletions(-) rename src/Explorer/Tabs/CloudShellTab/ShellTypes/{__tests__ => }/AbstractShellHandler.test.tsx (98%) rename src/Explorer/Tabs/CloudShellTab/ShellTypes/{__tests__ => }/CassandraShellHandler.test.tsx (95%) rename src/Explorer/Tabs/CloudShellTab/ShellTypes/{__tests__ => }/MongoShellHandler.test.tsx (94%) rename src/Explorer/Tabs/CloudShellTab/ShellTypes/{__tests__ => }/PostgresShellHandler.test.tsx (86%) rename src/Explorer/Tabs/CloudShellTab/ShellTypes/{__tests__ => }/ShellTypeFactory.test.tsx (82%) rename src/Explorer/Tabs/CloudShellTab/ShellTypes/{__tests__ => }/VCoreMongoShellHandler.test.tsx (96%) diff --git a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/AbstractShellHandler.test.tsx b/src/Explorer/Tabs/CloudShellTab/ShellTypes/AbstractShellHandler.test.tsx similarity index 98% rename from src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/AbstractShellHandler.test.tsx rename to src/Explorer/Tabs/CloudShellTab/ShellTypes/AbstractShellHandler.test.tsx index 82b714278..81c692120 100644 --- a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/AbstractShellHandler.test.tsx +++ b/src/Explorer/Tabs/CloudShellTab/ShellTypes/AbstractShellHandler.test.tsx @@ -1,4 +1,4 @@ -import { AbstractShellHandler, DISABLE_HISTORY, START_MARKER } from "../AbstractShellHandler"; +import { AbstractShellHandler, DISABLE_HISTORY, START_MARKER } from "./AbstractShellHandler"; // Mock implementation for testing class MockShellHandler extends AbstractShellHandler { diff --git a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/CassandraShellHandler.test.tsx b/src/Explorer/Tabs/CloudShellTab/ShellTypes/CassandraShellHandler.test.tsx similarity index 95% rename from src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/CassandraShellHandler.test.tsx rename to src/Explorer/Tabs/CloudShellTab/ShellTypes/CassandraShellHandler.test.tsx index 5258573b0..7c37d81b7 100644 --- a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/CassandraShellHandler.test.tsx +++ b/src/Explorer/Tabs/CloudShellTab/ShellTypes/CassandraShellHandler.test.tsx @@ -1,5 +1,5 @@ -import * as CommonUtils from "../../Utils/CommonUtils"; -import { CassandraShellHandler } from "../CassandraShellHandler"; +import * as CommonUtils from "../Utils/CommonUtils"; +import { CassandraShellHandler } from "./CassandraShellHandler"; // Define mock state that can be modified by tests const mockState = { @@ -12,7 +12,7 @@ const mockState = { }; // Mock dependencies using factory functions -jest.mock("../../../../../UserContext", () => ({ +jest.mock("../../../../UserContext", () => ({ get userContext() { return { get databaseAccount() { @@ -22,7 +22,7 @@ jest.mock("../../../../../UserContext", () => ({ } })); -jest.mock("../../Utils/CommonUtils", () => ({ +jest.mock("../Utils/CommonUtils", () => ({ getHostFromUrl: jest.fn().mockReturnValue("test-endpoint.cassandra.cosmos.azure.com") })); diff --git a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/MongoShellHandler.test.tsx b/src/Explorer/Tabs/CloudShellTab/ShellTypes/MongoShellHandler.test.tsx similarity index 94% rename from src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/MongoShellHandler.test.tsx rename to src/Explorer/Tabs/CloudShellTab/ShellTypes/MongoShellHandler.test.tsx index 057fa4980..52f3b56d9 100644 --- a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/MongoShellHandler.test.tsx +++ b/src/Explorer/Tabs/CloudShellTab/ShellTypes/MongoShellHandler.test.tsx @@ -3,12 +3,12 @@ * Tests for Mongo shell type handler */ -import { userContext } from "../../../../../UserContext"; -import * as CommonUtils from "../../Utils/CommonUtils"; -import { MongoShellHandler } from '../MongoShellHandler'; +import { userContext } from "../../../../UserContext"; +import * as CommonUtils from "../Utils/CommonUtils"; +import { MongoShellHandler } from './MongoShellHandler'; // Mock dependencies -jest.mock("../../../../../UserContext", () => ({ +jest.mock("../../../../UserContext", () => ({ userContext: { databaseAccount: { name: 'test-account', @@ -19,7 +19,7 @@ jest.mock("../../../../../UserContext", () => ({ } })); -jest.mock("../../Utils/CommonUtils", () => ({ +jest.mock("../Utils/CommonUtils", () => ({ getHostFromUrl: jest.fn().mockReturnValue('test-mongo.documents.azure.com') })); diff --git a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/PostgresShellHandler.test.tsx b/src/Explorer/Tabs/CloudShellTab/ShellTypes/PostgresShellHandler.test.tsx similarity index 86% rename from src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/PostgresShellHandler.test.tsx rename to src/Explorer/Tabs/CloudShellTab/ShellTypes/PostgresShellHandler.test.tsx index 68107cd9f..e6a6ca637 100644 --- a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/PostgresShellHandler.test.tsx +++ b/src/Explorer/Tabs/CloudShellTab/ShellTypes/PostgresShellHandler.test.tsx @@ -3,10 +3,10 @@ * Tests for PostgreSQL shell type handler */ -import { PostgresShellHandler } from '../PostgresShellHandler'; +import { PostgresShellHandler } from './PostgresShellHandler'; // Mock dependencies -jest.mock("../../../../../UserContext", () => ({ +jest.mock("../../../../UserContext", () => ({ userContext: { databaseAccount: { properties: { @@ -63,7 +63,7 @@ describe('PostgresShellHandler', () => { it('should handle missing PostgreSQL endpoint', () => { // Re-mock UserContext with missing endpoint jest.resetModules(); - jest.doMock("../../../../../UserContext", () => ({ + jest.doMock("../../../../UserContext", () => ({ userContext: { databaseAccount: { properties: {} @@ -72,7 +72,7 @@ describe('PostgresShellHandler', () => { })); // Import fresh instance with updated mock - const { PostgresShellHandler } = require('../PostgresShellHandler'); + const { PostgresShellHandler } = require('./PostgresShellHandler'); const handler = new PostgresShellHandler(); expect(handler.getEndpoint()).toBeUndefined(); @@ -83,7 +83,7 @@ describe('PostgresShellHandler', () => { // Reset mock to original state for subsequent tests jest.resetModules(); - jest.doMock("../../../../../UserContext", () => ({ + jest.doMock("../../../../UserContext", () => ({ userContext: { databaseAccount: { properties: { @@ -97,19 +97,19 @@ describe('PostgresShellHandler', () => { it('should handle null userContext', () => { // Re-mock UserContext as null jest.resetModules(); - jest.doMock("../../../../../UserContext", () => ({ + jest.doMock("../../../../UserContext", () => ({ userContext: null })); // Import fresh instance with updated mock - const { PostgresShellHandler } = require('../PostgresShellHandler'); + const { PostgresShellHandler } = require('./PostgresShellHandler'); const handler = new PostgresShellHandler(); expect(handler.getEndpoint()).toBeUndefined(); // Reset mock to original state for subsequent tests jest.resetModules(); - jest.doMock("../../../../../UserContext", () => ({ + jest.doMock("../../../../UserContext", () => ({ userContext: { databaseAccount: { properties: { @@ -123,21 +123,21 @@ describe('PostgresShellHandler', () => { it('should handle null databaseAccount', () => { // Re-mock UserContext with null databaseAccount jest.resetModules(); - jest.doMock("../../../../../UserContext", () => ({ + jest.doMock("../../../../UserContext", () => ({ userContext: { databaseAccount: null } })); // Clear cache and import fresh instance with updated mock - const { PostgresShellHandler } = require('../PostgresShellHandler'); + const { PostgresShellHandler } = require('./PostgresShellHandler'); const handler = new PostgresShellHandler(); expect(handler.getEndpoint()).toBeUndefined(); // Reset mock to original state for subsequent tests jest.resetModules(); - jest.doMock("../../../../../UserContext", () => ({ + jest.doMock("../../../../UserContext", () => ({ userContext: { databaseAccount: { properties: { diff --git a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/ShellTypeFactory.test.tsx b/src/Explorer/Tabs/CloudShellTab/ShellTypes/ShellTypeFactory.test.tsx similarity index 82% rename from src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/ShellTypeFactory.test.tsx rename to src/Explorer/Tabs/CloudShellTab/ShellTypes/ShellTypeFactory.test.tsx index c6944b868..a354341cd 100644 --- a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/ShellTypeFactory.test.tsx +++ b/src/Explorer/Tabs/CloudShellTab/ShellTypes/ShellTypeFactory.test.tsx @@ -1,14 +1,14 @@ -import { TerminalKind } from "../../../../../Contracts/ViewModels"; -import { userContext } from "../../../../../UserContext"; -import { listKeys } from "../../../../../Utils/arm/generatedClients/cosmos/databaseAccounts"; -import { CassandraShellHandler } from "../CassandraShellHandler"; -import { MongoShellHandler } from "../MongoShellHandler"; -import { PostgresShellHandler } from "../PostgresShellHandler"; -import { ShellTypeHandlerFactory } from "../ShellTypeFactory"; -import { VCoreMongoShellHandler } from "../VCoreMongoShellHandler"; +import { TerminalKind } from "../../../../Contracts/ViewModels"; +import { userContext } from "../../../../UserContext"; +import { listKeys } from "../../../../Utils/arm/generatedClients/cosmos/databaseAccounts"; +import { CassandraShellHandler } from "./CassandraShellHandler"; +import { MongoShellHandler } from "./MongoShellHandler"; +import { PostgresShellHandler } from "./PostgresShellHandler"; +import { ShellTypeHandlerFactory } from "./ShellTypeFactory"; +import { VCoreMongoShellHandler } from "./VCoreMongoShellHandler"; // Mock dependencies -jest.mock("../../../../../UserContext", () => ({ +jest.mock("../../../../UserContext", () => ({ userContext: { databaseAccount: { name: "testDbName" }, subscriptionId: "testSubId", @@ -16,7 +16,7 @@ jest.mock("../../../../../UserContext", () => ({ } })); -jest.mock("../../../../../Utils/arm/generatedClients/cosmos/databaseAccounts", () => ({ +jest.mock("../../../../Utils/arm/generatedClients/cosmos/databaseAccounts", () => ({ listKeys: jest.fn() })); diff --git a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/VCoreMongoShellHandler.test.tsx b/src/Explorer/Tabs/CloudShellTab/ShellTypes/VCoreMongoShellHandler.test.tsx similarity index 96% rename from src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/VCoreMongoShellHandler.test.tsx rename to src/Explorer/Tabs/CloudShellTab/ShellTypes/VCoreMongoShellHandler.test.tsx index f820b4397..f9441e69a 100644 --- a/src/Explorer/Tabs/CloudShellTab/ShellTypes/__tests__/VCoreMongoShellHandler.test.tsx +++ b/src/Explorer/Tabs/CloudShellTab/ShellTypes/VCoreMongoShellHandler.test.tsx @@ -3,10 +3,10 @@ * Tests for VCore MongoDB shell type handler */ -import { VCoreMongoShellHandler } from '../VCoreMongoShellHandler'; +import { VCoreMongoShellHandler } from './VCoreMongoShellHandler'; // Mock dependencies -jest.mock("../../../../../UserContext", () => ({ +jest.mock("../../../../UserContext", () => ({ userContext: { databaseAccount: { properties: {