Skip to content
Snippets Groups Projects
Commit 136baeda authored by Phil Hughes's avatar Phil Hughes
Browse files

Fixed Karma spec

parent 9904c127
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -66,7 +66,7 @@
},
beforeDestroy() {
eventHub.$off('enable.key', this.enableKey);
eventHub.$off('remove.key', this.removeKey);
eventHub.$off('remove.key', this.disableKey);
eventHub.$off('disable.key', this.disableKey);
},
};
Loading
Loading
Loading
Loading
@@ -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', () => {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment