Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanjassal committed Oct 18, 2024
1 parent 23a05d0 commit 6ed1feb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/secrets/cat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('commandCatSecret', () => {
env: { PK_PASSWORD: password },
cwd: dataDir,
});
expect(result.exitCode).toBe(0);
expect(result.exitCode).not.toBe(0);
expect(result.stderr).toBeDefined();
});
test('should concatenate multiple secrets', async () => {
Expand Down
21 changes: 14 additions & 7 deletions tests/secrets/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ describe('commandListSecrets', () => {
cwd: dataDir,
});
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe(
`${secretName1}\n${secretName2}\n${secretName3}\n`,
);
expect(result.stdout.trim().split('\n')).toEqual([
secretName1,
secretName2,
secretName3,
]);
});
test('should list secrets', async () => {
const vaultName = 'vault' as VaultName;
Expand All @@ -86,9 +88,11 @@ describe('commandListSecrets', () => {
cwd: dataDir,
});
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe(
`${secretName1}\n${secretName2}\n${secretName3}\n`,
);
expect(result.stdout.trim().split('\n')).toEqual([
secretName1,
secretName2,
secretName3,
]);
});
test('should fail when path is not a directory', async () => {
const vaultName = 'vault' as VaultName;
Expand Down Expand Up @@ -141,7 +145,10 @@ describe('commandListSecrets', () => {
cwd: dataDir,
});
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe(`${secretDirName1}\n${nestedDir}\n`);
expect(result.stdout.trim().split('\n')).toEqual([
nestedDir,
secretDirName1,
]);
command = ['secrets', 'ls', '-np', dataDir, `${vaultName}:${nestedDir}`];
result = await testUtils.pkStdio(command, {
env: { PK_PASSWORD: password },
Expand Down

0 comments on commit 6ed1feb

Please sign in to comment.