diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-04 19:31:59 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-04 19:31:59 +0300 |
commit | 136baeda508ddf46f6d91c03d4128b2ee890d205 (patch) | |
tree | 655907e241ffabaaedad7b511feac102403dae0d /spec/javascripts/deploy_keys | |
parent | 9904c12746e744c4e271fe454b04a54dfb9b668e (diff) |
Fixed Karma spec
Diffstat (limited to 'spec/javascripts/deploy_keys')
-rw-r--r-- | spec/javascripts/deploy_keys/components/app_spec.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/javascripts/deploy_keys/components/app_spec.js b/spec/javascripts/deploy_keys/components/app_spec.js index 43b8f718508..700897f50b0 100644 --- a/spec/javascripts/deploy_keys/components/app_spec.js +++ b/spec/javascripts/deploy_keys/components/app_spec.js @@ -116,15 +116,24 @@ describe('Deploy keys app component', () => { expect(vm.service.disableKey).toHaveBeenCalledWith(key.id); }); - it('calls disableKey when removing a key', () => { + it('calls disableKey when removing a key', (done) => { const key = data.public_keys[0]; spyOn(window, 'confirm').and.returnValue(true); - spyOn(vm, 'disableKey'); + spyOn(vm.service, 'getKeys'); + spyOn(vm.service, 'disableKey').and.callFake(() => new Promise((resolve) => { + resolve(); + + setTimeout(() => { + expect(vm.service.getKeys).toHaveBeenCalled(); + + done(); + }); + })); eventHub.$emit('remove.key', key); - expect(vm.disableKey).toHaveBeenCalledWith(key); + expect(vm.service.disableKey).toHaveBeenCalledWith(key.id); }); it('hasKeys returns true when there are keys', () => { |