Commit 136baeda authored by Phil Hughes's avatar Phil Hughes

Fixed Karma spec

parent 9904c127
......@@ -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);
},
};
......
......@@ -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', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment