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

Function flagTestHelper

test/helpers/index.ts:129–143  ·  view source on GitHub ↗
(
  flag: string,
  flagInput: string | number | undefined,
  debug = false
)

Source from the content-addressed store, hash-verified

127}
128
129export const flagTestHelper = async (
130 flag: string,
131 flagInput: string | number | undefined,
132 debug = false
133): Promise<void> => {
134 debug && logger.debug('******')
135 debug && logger.debug(`Flag '--${flag}' Test(helper)`)
136 const flagInputConcatString = flagInput ? `=${flagInput}` : ''
137 const flagEntry = `--${flag}${flagInputConcatString}`
138 debug && logger.debug(`Full flag arg to test: '${flagEntry}'`)
139 const Init = await getInitCommand([flagEntry])
140 const { flags } = await parseArgv(Init)
141 debug && logger.debug(`Parsed result: ${flags[flag]}`)
142 expect(flags[flag]).toBe(flagInput ?? true)
143}
144
145export const initCommandPromptGetterMethodTester = async (
146 spyFn: jest.SpyInstance,

Callers 1

init.test.tsFile · 0.90

Calls 2

getInitCommandFunction · 0.85
parseArgvFunction · 0.85

Tested by

no test coverage detected