From c00b4eb9c92fa3ae6a0b597100e17b79052c556c Mon Sep 17 00:00:00 2001 From: phalestrivir Date: Tue, 7 May 2024 11:25:37 -0600 Subject: [PATCH] Update mock naming so tests pass in frodo-cli --- src/utils/SetupPollyForFrodoLib.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/utils/SetupPollyForFrodoLib.ts b/src/utils/SetupPollyForFrodoLib.ts index 01a4b533e..6695719aa 100644 --- a/src/utils/SetupPollyForFrodoLib.ts +++ b/src/utils/SetupPollyForFrodoLib.ts @@ -184,7 +184,32 @@ function getFrodoCommand({ state }: { state: State }) { '/' + getFrodoArgsId({ start: 2, state }); } else { - cmd = process.argv[2] + '/' + getFrodoArgsId({ start: 3, state }); + cmd = process.argv[2] + '/'; + let i = 3; + if (cmd === 'info/') { + cmd += getFrodoArgsId({ start: 3, state }); + } else { + if ( + process.argv[i] === 'export' || + process.argv[i] === 'import' || + process.argv[i] === 'list' || + process.argv[i] === 'delete' || + process.argv[i] === 'count' || + process.argv[i] === 'describe' || + process.argv[i] === 'enable' || + process.argv[i] === 'disable' + ) { + cmd += process.argv[i++] + '/'; + } + let firstParamIndex = process.argv.findIndex((a) => a.startsWith('-')); + firstParamIndex = + firstParamIndex === -1 ? process.argv.length : firstParamIndex; + cmd += process.argv.slice(i, firstParamIndex).join('-'); + if (!cmd.endsWith('/')) { + cmd += '/'; + } + cmd += getFrodoArgsId({ start: firstParamIndex, state }); + } } } catch (error) { printMessage({