MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / initCommandPromptGetterMethodTester

Function initCommandPromptGetterMethodTester

test/helpers/index.ts:145–170  ·  view source on GitHub ↗
(
  spyFn: jest.SpyInstance,
  mock: MockInitCmdPromptExpectation,
  debug = false
)

Source from the content-addressed store, hash-verified

143}
144
145export const initCommandPromptGetterMethodTester = async (
146 spyFn: jest.SpyInstance,
147 mock: MockInitCmdPromptExpectation,
148 debug = false
149): Promise<void> => {
150 debug && logger.debug('******')
151 debug && logger.debug(`Test ${mock.methodToTest}`)
152 debug && logger.debug(`overwriteFlag: ${JSON.stringify(mock.overwriteFlag)}`)
153 debug &&
154 logger.debug(`promptExpectation: ${JSON.stringify(mock.promptExpectation)}`)
155 mock.promptExpectation.forEach(expectation =>
156 spyFn.mockResolvedValueOnce(expectation)
157 )
158 const InitCommand = await getInitCommand([''], 'aws')
159 const cloudGraphConfig = InitCommand.getCGConfig('cloudGraph')
160 debug &&
161 logger.debug(
162 `Config Dir -> ${JSON.stringify(InitCommand.config.configDir)}`
163 )
164 debug && logger.debug(`Config -> ${JSON.stringify(cloudGraphConfig)}`)
165 const response = await InitCommand[mock.methodToTest](mock.overwriteFlag)
166 debug && logger.debug(`response: ${JSON.stringify(response)}`)
167 expect(response).toMatchObject(mock.expectedResult)
168 debug &&
169 logger.debug(`expectedResult: ${JSON.stringify(mock.expectedResult)}`)
170}
171
172export const initCommandNoOverwriteTester = async (
173 mock: MockInitCmdPromptExpectation | MockInitCmdFlagsExpectation,

Callers 1

init.test.tsFile · 0.90

Calls 1

getInitCommandFunction · 0.85

Tested by

no test coverage detected