moved files

This commit is contained in:
Sourabh Jain 2025-04-11 16:15:25 +05:30
parent 209c5b776c
commit 989eaec632
6 changed files with 33 additions and 33 deletions

View File

@ -1,4 +1,4 @@
import { AbstractShellHandler, DISABLE_HISTORY, START_MARKER } from "../AbstractShellHandler"; import { AbstractShellHandler, DISABLE_HISTORY, START_MARKER } from "./AbstractShellHandler";
// Mock implementation for testing // Mock implementation for testing
class MockShellHandler extends AbstractShellHandler { class MockShellHandler extends AbstractShellHandler {

View File

@ -1,5 +1,5 @@
import * as CommonUtils from "../../Utils/CommonUtils"; import * as CommonUtils from "../Utils/CommonUtils";
import { CassandraShellHandler } from "../CassandraShellHandler"; import { CassandraShellHandler } from "./CassandraShellHandler";
// Define mock state that can be modified by tests // Define mock state that can be modified by tests
const mockState = { const mockState = {
@ -12,7 +12,7 @@ const mockState = {
}; };
// Mock dependencies using factory functions // Mock dependencies using factory functions
jest.mock("../../../../../UserContext", () => ({ jest.mock("../../../../UserContext", () => ({
get userContext() { get userContext() {
return { return {
get databaseAccount() { 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") getHostFromUrl: jest.fn().mockReturnValue("test-endpoint.cassandra.cosmos.azure.com")
})); }));

View File

@ -3,12 +3,12 @@
* Tests for Mongo shell type handler * Tests for Mongo shell type handler
*/ */
import { userContext } from "../../../../../UserContext"; import { userContext } from "../../../../UserContext";
import * as CommonUtils from "../../Utils/CommonUtils"; import * as CommonUtils from "../Utils/CommonUtils";
import { MongoShellHandler } from '../MongoShellHandler'; import { MongoShellHandler } from './MongoShellHandler';
// Mock dependencies // Mock dependencies
jest.mock("../../../../../UserContext", () => ({ jest.mock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
name: 'test-account', 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') getHostFromUrl: jest.fn().mockReturnValue('test-mongo.documents.azure.com')
})); }));

View File

@ -3,10 +3,10 @@
* Tests for PostgreSQL shell type handler * Tests for PostgreSQL shell type handler
*/ */
import { PostgresShellHandler } from '../PostgresShellHandler'; import { PostgresShellHandler } from './PostgresShellHandler';
// Mock dependencies // Mock dependencies
jest.mock("../../../../../UserContext", () => ({ jest.mock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
properties: { properties: {
@ -63,7 +63,7 @@ describe('PostgresShellHandler', () => {
it('should handle missing PostgreSQL endpoint', () => { it('should handle missing PostgreSQL endpoint', () => {
// Re-mock UserContext with missing endpoint // Re-mock UserContext with missing endpoint
jest.resetModules(); jest.resetModules();
jest.doMock("../../../../../UserContext", () => ({ jest.doMock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
properties: {} properties: {}
@ -72,7 +72,7 @@ describe('PostgresShellHandler', () => {
})); }));
// Import fresh instance with updated mock // Import fresh instance with updated mock
const { PostgresShellHandler } = require('../PostgresShellHandler'); const { PostgresShellHandler } = require('./PostgresShellHandler');
const handler = new PostgresShellHandler(); const handler = new PostgresShellHandler();
expect(handler.getEndpoint()).toBeUndefined(); expect(handler.getEndpoint()).toBeUndefined();
@ -83,7 +83,7 @@ describe('PostgresShellHandler', () => {
// Reset mock to original state for subsequent tests // Reset mock to original state for subsequent tests
jest.resetModules(); jest.resetModules();
jest.doMock("../../../../../UserContext", () => ({ jest.doMock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
properties: { properties: {
@ -97,19 +97,19 @@ describe('PostgresShellHandler', () => {
it('should handle null userContext', () => { it('should handle null userContext', () => {
// Re-mock UserContext as null // Re-mock UserContext as null
jest.resetModules(); jest.resetModules();
jest.doMock("../../../../../UserContext", () => ({ jest.doMock("../../../../UserContext", () => ({
userContext: null userContext: null
})); }));
// Import fresh instance with updated mock // Import fresh instance with updated mock
const { PostgresShellHandler } = require('../PostgresShellHandler'); const { PostgresShellHandler } = require('./PostgresShellHandler');
const handler = new PostgresShellHandler(); const handler = new PostgresShellHandler();
expect(handler.getEndpoint()).toBeUndefined(); expect(handler.getEndpoint()).toBeUndefined();
// Reset mock to original state for subsequent tests // Reset mock to original state for subsequent tests
jest.resetModules(); jest.resetModules();
jest.doMock("../../../../../UserContext", () => ({ jest.doMock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
properties: { properties: {
@ -123,21 +123,21 @@ describe('PostgresShellHandler', () => {
it('should handle null databaseAccount', () => { it('should handle null databaseAccount', () => {
// Re-mock UserContext with null databaseAccount // Re-mock UserContext with null databaseAccount
jest.resetModules(); jest.resetModules();
jest.doMock("../../../../../UserContext", () => ({ jest.doMock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: null databaseAccount: null
} }
})); }));
// Clear cache and import fresh instance with updated mock // Clear cache and import fresh instance with updated mock
const { PostgresShellHandler } = require('../PostgresShellHandler'); const { PostgresShellHandler } = require('./PostgresShellHandler');
const handler = new PostgresShellHandler(); const handler = new PostgresShellHandler();
expect(handler.getEndpoint()).toBeUndefined(); expect(handler.getEndpoint()).toBeUndefined();
// Reset mock to original state for subsequent tests // Reset mock to original state for subsequent tests
jest.resetModules(); jest.resetModules();
jest.doMock("../../../../../UserContext", () => ({ jest.doMock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
properties: { properties: {

View File

@ -1,14 +1,14 @@
import { TerminalKind } from "../../../../../Contracts/ViewModels"; import { TerminalKind } from "../../../../Contracts/ViewModels";
import { userContext } from "../../../../../UserContext"; import { userContext } from "../../../../UserContext";
import { listKeys } from "../../../../../Utils/arm/generatedClients/cosmos/databaseAccounts"; import { listKeys } from "../../../../Utils/arm/generatedClients/cosmos/databaseAccounts";
import { CassandraShellHandler } from "../CassandraShellHandler"; import { CassandraShellHandler } from "./CassandraShellHandler";
import { MongoShellHandler } from "../MongoShellHandler"; import { MongoShellHandler } from "./MongoShellHandler";
import { PostgresShellHandler } from "../PostgresShellHandler"; import { PostgresShellHandler } from "./PostgresShellHandler";
import { ShellTypeHandlerFactory } from "../ShellTypeFactory"; import { ShellTypeHandlerFactory } from "./ShellTypeFactory";
import { VCoreMongoShellHandler } from "../VCoreMongoShellHandler"; import { VCoreMongoShellHandler } from "./VCoreMongoShellHandler";
// Mock dependencies // Mock dependencies
jest.mock("../../../../../UserContext", () => ({ jest.mock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { name: "testDbName" }, databaseAccount: { name: "testDbName" },
subscriptionId: "testSubId", 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() listKeys: jest.fn()
})); }));

View File

@ -3,10 +3,10 @@
* Tests for VCore MongoDB shell type handler * Tests for VCore MongoDB shell type handler
*/ */
import { VCoreMongoShellHandler } from '../VCoreMongoShellHandler'; import { VCoreMongoShellHandler } from './VCoreMongoShellHandler';
// Mock dependencies // Mock dependencies
jest.mock("../../../../../UserContext", () => ({ jest.mock("../../../../UserContext", () => ({
userContext: { userContext: {
databaseAccount: { databaseAccount: {
properties: { properties: {