Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cloud-cli/vm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: cloud-cli/vm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 10, 2023

  1. fix: update exec

    darlanalves committed Mar 10, 2023
    Copy the full SHA
    bfd4db1 View commit details
  2. test: fix specs

    darlanalves committed Mar 10, 2023
    Copy the full SHA
    828b08f View commit details
Showing with 10 additions and 10 deletions.
  1. +6 −6 package-lock.json
  2. +3 −3 src/index.spec.ts
  3. +1 −1 src/index.ts
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -104,22 +104,22 @@ describe('volume manager', () => {
const execOutput = { ok: true, stdout: '' };
execMocks.exec = jest.fn().mockResolvedValue(execOutput);

await expect(vm.delete({ name: 'test' })).resolves.toEqual('');
await expect(vm.remove({ name: 'test' })).resolves.toEqual('');

expect(exec.exec).toHaveBeenCalledWith('docker', ['volume', 'rm', 'test']);
});

it('should throw error if volume name is invalid', async () => {
execMocks.exec = jest.fn();
await expect(vm.delete({ name: 'In$%valid' })).rejects.toThrowError('Invalid name');
await expect(vm.remove({ name: 'In$%valid' })).rejects.toThrowError('Invalid name');
expect(exec.exec).not.toHaveBeenCalled();
});

it('should throw error if volume removal fails', async () => {
const output = { ok: false, stdout: '' };
execMocks.exec = jest.fn().mockResolvedValue(output);

await expect(vm.delete({ name: 'failed' })).rejects.toThrowError('Unable to remove volume');
await expect(vm.remove({ name: 'failed' })).rejects.toThrowError('Unable to remove volume');
});
});

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -72,4 +72,4 @@ async function prune() {
return '';
}

export default { add, list, show, delete: remove, prune };
export default { add, remove, list, show, prune };