Skip to content

Commit 8ab09f3

Browse files
committed
fix: consistently using command instead of [...command] in secret tests
1 parent 177e775 commit 8ab09f3

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

tests/secrets/env.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('commandEnv', () => {
6767
'console.log(JSON.stringify(process.env))',
6868
];
6969

70-
const result = await testUtils.pkExec([...command], {
70+
const result = await testUtils.pkExec(command, {
7171
env: { PK_PASSWORD: password },
7272
});
7373
expect(result.exitCode).toBe(0);
@@ -97,7 +97,7 @@ describe('commandEnv', () => {
9797
'console.log(JSON.stringify(process.env))',
9898
];
9999

100-
const result = await testUtils.pkExec([...command], {
100+
const result = await testUtils.pkExec(command, {
101101
env: { PK_PASSWORD: password },
102102
});
103103
expect(result.exitCode).toBe(0);
@@ -129,7 +129,7 @@ describe('commandEnv', () => {
129129
'console.log(JSON.stringify(process.env))',
130130
];
131131

132-
const result = await testUtils.pkExec([...command], {
132+
const result = await testUtils.pkExec(command, {
133133
env: { PK_PASSWORD: password },
134134
});
135135
expect(result.exitCode).toBe(0);
@@ -159,7 +159,7 @@ describe('commandEnv', () => {
159159
'console.log(JSON.stringify(process.env))',
160160
];
161161

162-
const result = await testUtils.pkExec([...command], {
162+
const result = await testUtils.pkExec(command, {
163163
env: { PK_PASSWORD: password },
164164
});
165165
expect(result.exitCode).toBe(0);
@@ -190,7 +190,7 @@ describe('commandEnv', () => {
190190
'console.log(JSON.stringify(process.env))',
191191
];
192192

193-
const result = await testUtils.pkExec([...command], {
193+
const result = await testUtils.pkExec(command, {
194194
env: { PK_PASSWORD: password },
195195
});
196196
expect(result.exitCode).toBe(0);
@@ -226,7 +226,7 @@ describe('commandEnv', () => {
226226
'console.log(JSON.stringify(process.env))',
227227
];
228228

229-
const result = await testUtils.pkExec([...command], {
229+
const result = await testUtils.pkExec(command, {
230230
env: { PK_PASSWORD: password },
231231
});
232232
expect(result.exitCode).toBe(0);
@@ -257,7 +257,7 @@ describe('commandEnv', () => {
257257
'console.log(JSON.stringify(process.env))',
258258
];
259259

260-
const result = await testUtils.pkExec([...command], {
260+
const result = await testUtils.pkExec(command, {
261261
env: {
262262
PK_PASSWORD: password,
263263
EXISTING: 'existing var',
@@ -296,7 +296,7 @@ describe('commandEnv', () => {
296296
'console.log(JSON.stringify(process.env))',
297297
];
298298

299-
const result = await testUtils.pkExec([...command], {
299+
const result = await testUtils.pkExec(command, {
300300
env: { PK_PASSWORD: password },
301301
});
302302
expect(result.exitCode).toBe(0);
@@ -328,7 +328,7 @@ describe('commandEnv', () => {
328328
`${vaultName}`,
329329
];
330330

331-
const result = await testUtils.pkExec([...command], {
331+
const result = await testUtils.pkExec(command, {
332332
env: { PK_PASSWORD: password },
333333
});
334334
expect(result.exitCode).toBe(0);
@@ -368,7 +368,7 @@ describe('commandEnv', () => {
368368
`${vaultName}2`,
369369
];
370370

371-
const result = await testUtils.pkExec([...command], {
371+
const result = await testUtils.pkExec(command, {
372372
env: { PK_PASSWORD: password },
373373
});
374374
expect(result.exitCode).toBe(0);
@@ -408,7 +408,7 @@ describe('commandEnv', () => {
408408
`${vaultName}2`,
409409
];
410410

411-
const result = await testUtils.pkExec([...command], {
411+
const result = await testUtils.pkExec(command, {
412412
env: { PK_PASSWORD: password },
413413
});
414414
expect(result.exitCode).toBe(0);
@@ -448,7 +448,7 @@ describe('commandEnv', () => {
448448
`${vaultName}2`,
449449
];
450450

451-
const result = await testUtils.pkExec([...command], {
451+
const result = await testUtils.pkExec(command, {
452452
env: { PK_PASSWORD: password },
453453
});
454454
expect(result.exitCode).toBe(0);
@@ -478,7 +478,7 @@ describe('commandEnv', () => {
478478
`${vaultName}`,
479479
];
480480

481-
const result = await testUtils.pkExec([...command], {
481+
const result = await testUtils.pkExec(command, {
482482
env: { PK_PASSWORD: password },
483483
});
484484
expect(result.exitCode).toBe(0);
@@ -757,7 +757,7 @@ describe('commandEnv', () => {
757757
'console.log(JSON.stringify(process.env))',
758758
];
759759

760-
const result = await testUtils.pkExec([...command], {
760+
const result = await testUtils.pkExec(command, {
761761
env: { PK_PASSWORD: password },
762762
});
763763
expect(result.exitCode).toBe(0);
@@ -794,7 +794,7 @@ describe('commandEnv', () => {
794794
test('handles no arguments', async () => {
795795
command = ['secrets', 'env', '-np', dataDir, '--env-format', 'unix'];
796796

797-
const result1 = await testUtils.pkExec([...command], {
797+
const result1 = await testUtils.pkExec(command, {
798798
env: { PK_PASSWORD: password },
799799
});
800800
expect(result1.exitCode).toBe(64);
@@ -811,7 +811,7 @@ describe('commandEnv', () => {
811811
'someCommand',
812812
];
813813

814-
const result1 = await testUtils.pkExec([...command], {
814+
const result1 = await testUtils.pkExec(command, {
815815
env: { PK_PASSWORD: password },
816816
});
817817
expect(result1.exitCode).toBe(64);
@@ -847,7 +847,7 @@ describe('commandEnv', () => {
847847
`${vaultName}2`,
848848
];
849849

850-
const result = await testUtils.pkExec([...command], {
850+
const result = await testUtils.pkExec(command, {
851851
env: { PK_PASSWORD: password },
852852
});
853853
expect(result.exitCode).toBe(0);

tests/secrets/mkdir.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('commandMkdir', () => {
4646
const dirName = 'dir';
4747
const vaultId = await polykeyAgent.vaultManager.createVault(vaultName);
4848
command = ['secrets', 'mkdir', '-np', dataDir, `${vaultName}:${dirName}`];
49-
const result = await testUtils.pkStdio([...command], {
49+
const result = await testUtils.pkStdio(command, {
5050
env: { PK_PASSWORD: password },
5151
cwd: dataDir,
5252
});
@@ -60,7 +60,7 @@ describe('commandMkdir', () => {
6060
const vaultName = 'vault' as VaultName;
6161
const vaultId = await polykeyAgent.vaultManager.createVault(vaultName);
6262
command = ['secrets', 'mkdir', '-np', dataDir, vaultName];
63-
const result = await testUtils.pkStdio([...command], {
63+
const result = await testUtils.pkStdio(command, {
6464
env: { PK_PASSWORD: password },
6565
cwd: dataDir,
6666
});
@@ -84,7 +84,7 @@ describe('commandMkdir', () => {
8484
`${vaultName}:${dirNameNested}`,
8585
'--parents',
8686
];
87-
const result = await testUtils.pkStdio([...command], {
87+
const result = await testUtils.pkStdio(command, {
8888
env: { PK_PASSWORD: password },
8989
cwd: dataDir,
9090
});
@@ -109,7 +109,7 @@ describe('commandMkdir', () => {
109109
dataDir,
110110
`${vaultName}:${dirNameNested}`,
111111
];
112-
const result = await testUtils.pkStdio([...command], {
112+
const result = await testUtils.pkStdio(command, {
113113
env: { PK_PASSWORD: password },
114114
cwd: dataDir,
115115
});
@@ -134,7 +134,7 @@ describe('commandMkdir', () => {
134134
});
135135
});
136136
command = ['secrets', 'mkdir', '-np', dataDir, `${vaultName}:${dirName}`];
137-
const result = await testUtils.pkStdio([...command], {
137+
const result = await testUtils.pkStdio(command, {
138138
env: { PK_PASSWORD: password },
139139
cwd: dataDir,
140140
});
@@ -164,7 +164,7 @@ describe('commandMkdir', () => {
164164
dataDir,
165165
`${vaultName}:${secretName}`,
166166
];
167-
const result = await testUtils.pkStdio([...command], {
167+
const result = await testUtils.pkStdio(command, {
168168
env: { PK_PASSWORD: password },
169169
cwd: dataDir,
170170
});
@@ -196,7 +196,7 @@ describe('commandMkdir', () => {
196196
`${vaultName2}:${dirName2}`,
197197
`${vaultName1}:${dirName3}`,
198198
];
199-
const result = await testUtils.pkStdio([...command], {
199+
const result = await testUtils.pkStdio(command, {
200200
env: { PK_PASSWORD: password },
201201
cwd: dataDir,
202202
});
@@ -232,7 +232,7 @@ describe('commandMkdir', () => {
232232
`${vaultName2}:${dirName3}`,
233233
`${vaultName1}:${dirName4}`,
234234
];
235-
const result = await testUtils.pkStdio([...command], {
235+
const result = await testUtils.pkStdio(command, {
236236
env: { PK_PASSWORD: password },
237237
cwd: dataDir,
238238
});

0 commit comments

Comments
 (0)