aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-04-11 20:02:33 +0800
committerGitHub <noreply@github.com>2019-04-11 20:02:33 +0800
commit5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95 (patch)
tree695f7fc0bd2f6d940f64739a1f1f500c36806cef /Timeline/ClientApp/src/app/user/user-logout/user-logout.component.spec.ts
parent1c9edc5914869a3bbde20742c483182636ee4d43 (diff)
parentc28941c6d86f8ea33521bba49d811bf3ff60b3d1 (diff)
downloadtimeline-5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95.tar.gz
timeline-5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95.tar.bz2
timeline-5b5ca3acb1b9decb5ad13798dc79ba2d58f2ce95.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.ts35
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();
+ });
+});