11import type { VaultName } from 'polykey/dist/vaults/types' ;
2- import type { ParsedSecretPathValue } from '@/types' ;
32import path from 'path' ;
43import fs from 'fs' ;
54import fc from 'fast-check' ;
@@ -9,7 +8,6 @@ import PolykeyAgent from 'polykey/dist/PolykeyAgent';
98import { vaultOps } from 'polykey/dist/vaults' ;
109import * as keysUtils from 'polykey/dist/keys/utils' ;
1110import { sysexits } from 'polykey/dist/utils' ;
12- import * as binParsers from '@/utils/parsers' ;
1311import * as testUtils from '../utils' ;
1412
1513describe ( 'commandEnv' , ( ) => {
@@ -865,35 +863,6 @@ describe('commandEnv', () => {
865863 expect ( jsonOut2 [ secretName2 ] ) . toBe ( secretContent2 ) ;
866864 expect ( jsonOut2 [ secretName3 ] ) . toBe ( secretContent3 ) ;
867865 } ) ;
868- test . prop ( [
869- testUtils . secretPathEnvArrayArb ,
870- fc . string ( ) . noShrink ( ) ,
871- testUtils . cmdArgsArrayArb ,
872- ] ) (
873- 'parse secrets env arguments' ,
874- async ( secretPathEnvArray , cmd , cmdArgsArray ) => {
875- let output :
876- | [ Array < ParsedSecretPathValue > , Array < string > , boolean ]
877- | undefined = undefined ;
878- // By running the parser directly, we are bypassing commander, so it works
879- // with a single --
880- const args : Array < string > = [
881- ...secretPathEnvArray ,
882- '--' ,
883- cmd ,
884- ...cmdArgsArray ,
885- ] ;
886- for ( const arg of args ) {
887- output = binParsers . parseEnvArgs ( arg , output ) ;
888- }
889- const [ parsedEnvs , parsedArgs ] = output ! ;
890- const expectedSecretPathArray = secretPathEnvArray . map ( ( v ) => {
891- return binParsers . parseSecretPath ( v ) ;
892- } ) ;
893- expect ( parsedEnvs ) . toMatchObject ( expectedSecretPathArray ) ;
894- expect ( parsedArgs ) . toMatchObject ( [ cmd , ...cmdArgsArray ] ) ;
895- } ,
896- ) ;
897866 test ( 'handles no arguments' , async ( ) => {
898867 const command = [ 'secrets' , 'env' , '-np' , dataDir , '--env-format' , 'unix' ] ;
899868 const result = await testUtils . pkExec ( command , {
0 commit comments