Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
dotCMS/core#16591 Error when login and logout as limited user (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyDOTCMS authored and fmontes committed May 20, 2019
1 parent 28f93d3 commit 8e46e57
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions projects/dotcms-js/src/lib/core/dotcms-events.service.spec.ts
Expand Up @@ -33,6 +33,8 @@ class DotEventsSocketMock {
isConnected(): boolean {
return this.connected;
}

destroy(): void {}
}


Expand Down Expand Up @@ -125,4 +127,23 @@ describe('DotcmsEventsService', () => {

expect(count).toBe(2);
});

it('should destroy socket', () => {
spyOn(socket, 'destroy').and.callThrough();

dotcmsEventsService.destroy();

expect(socket.destroy).toHaveBeenCalled();
});

it('should destroy socket and connect', () => {
spyOn(socket, 'destroy').and.callThrough();
spyOn(socket, 'connect').and.callThrough();

dotcmsEventsService.destroy();
expect(socket.destroy).toHaveBeenCalled();

dotcmsEventsService.start();
expect(socket.connect).toHaveBeenCalledTimes(1);
});
});
1 change: 0 additions & 1 deletion projects/dotcms-js/src/lib/core/dotcms-events.service.ts
Expand Up @@ -20,7 +20,6 @@ export class DotcmsEventsService {
*/
destroy(): void {
this.dotEventsSocket.destroy();
this.dotEventsSocket = null;
}

/**
Expand Down

0 comments on commit 8e46e57

Please sign in to comment.