mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-05-05 07:53:16 +01:00
moved files
This commit is contained in:
parent
209c5b776c
commit
989eaec632
@ -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 {
|
@ -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")
|
||||
}));
|
||||
|
@ -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')
|
||||
}));
|
||||
|
@ -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: {
|
@ -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()
|
||||
}));
|
||||
|
@ -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: {
|
Loading…
x
Reference in New Issue
Block a user