diff options
author | 杨宇千 <crupest@outlook.com> | 2019-04-11 20:02:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 20:02:33 +0800 |
commit | 1eb6d9abfc24eec380b7b5d7423102a53041239e (patch) | |
tree | d37779e900de492491c862eb64ba2e79cf10af83 /Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts | |
parent | 393ca55a960abc7d2343a8a36a093d253eddf134 (diff) | |
parent | d328e1eac76d9e28563b118e42f8ee5cf5fe43d8 (diff) | |
download | timeline-1eb6d9abfc24eec380b7b5d7423102a53041239e.tar.gz timeline-1eb6d9abfc24eec380b7b5d7423102a53041239e.tar.bz2 timeline-1eb6d9abfc24eec380b7b5d7423102a53041239e.zip |
Merge pull request #17 from crupest/15-user
Remember me and log out feature.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts new file mode 100644 index 00000000..855ea4a1 --- /dev/null +++ b/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts @@ -0,0 +1,35 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserLogoutComponent } from './user-logout.component'; +import { InternalUserService } from '../internal-user-service/internal-user.service'; + +describe('UserLogoutComponent', () => { + let component: UserLogoutComponent; + let fixture: ComponentFixture<UserLogoutComponent>; + + let mockInternalUserService: jasmine.SpyObj<InternalUserService>; + + beforeEach(async(() => { + mockInternalUserService = jasmine.createSpyObj('InternalUserService', ['logout']); + + TestBed.configureTestingModule({ + declarations: [UserLogoutComponent], + providers: [{ provide: InternalUserService, useValue: mockInternalUserService }] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserLogoutComponent); + component = fixture.componentInstance; + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should logout on init', () => { + fixture.detectChanges(); + expect(mockInternalUserService.logout).toHaveBeenCalled(); + }); +}); |