跳到主要内容
版本:Next

MidwayMockService

Index

Constructors

constructor

Properties

readonlyapplicationContext

applicationContext: IMidwayContainer

staticprepareMocks

prepareMocks: any[] = []

Prepare mocks before the service is initialized

Methods

applyContextMocks

getContextMocksSize

  • getContextMocksSize(): number

init

  • init(): Promise<void>

publicinitSimulation

  • initSimulation(group?: string): Promise<void>

publicisMocked

  • isMocked(obj: any, key: any, group?: string): boolean

publicmockClassProperty

  • mockClassProperty(clzz: new (...args: any[]) => any, propertyName: string, value: any, group?: string): void

publicmockContext

publicmockProperty

  • mockProperty(obj: any, key: string, value: any, group?: string): void

publicrestore

  • restore(group?: string): void

publicrestoreAll

  • restoreAll(): void

publicrunSimulatorAppSetup

publicrunSimulatorAppTearDown

publicrunSimulatorContextSetup

publicrunSimulatorContextTearDown

publicrunSimulatorSetup

  • runSimulatorSetup(): Promise<void>

publicrunSimulatorTearDown

  • runSimulatorTearDown(): Promise<void>

staticmockClassProperty

  • mockClassProperty(clzz: new (...args: any[]) => any, propertyName: string, value: any, group?: string): void

staticmockProperty

  • mockProperty(obj: new (...args: any[]) => any, key: string, value: any, group?: string): void