From a643326a23f6c0323eddd3ba5ef922ccb550a098 Mon Sep 17 00:00:00 2001 From: Alexander Lyapko Date: Wed, 6 Jun 2018 00:09:20 +0400 Subject: [PATCH] #3 Increase test coverage * #3 Cover PasswordGeneratorService * #3 Cover StorageApiService * #3 Cover EditFormComponent --- package.json | 28 ++-- src/app/auth/auth.module.ts | 2 + src/app/auth/auth.service.ts | 1 + src/app/auth/login/login.component.html | 1 + src/app/auth/login/login.component.spec.ts | 7 + src/app/fork-me/fork-me.component.html | 32 ++++ src/app/fork-me/fork-me.component.scss | 24 +++ src/app/fork-me/fork-me.component.spec.ts | 25 +++ src/app/fork-me/fork-me.component.ts | 11 ++ src/app/fork-me/index.ts | 1 + src/app/navigation/navigation.component.html | 4 - .../password-generator.service.spec.ts | 68 +++++++- .../password-generator.service.ts | 2 +- .../edit-form-folder.component.spec.ts | 97 +++++++++++ .../edit-form-secret.component.spec.ts | 139 ++++++++++++++++ .../edit-form/edit-form.component.spec.ts | 150 ++++++++++++++++++ .../edit-form/edit-form.component.ts | 2 +- .../edit-form/edit-form.service.spec.ts | 64 ++++++++ .../storage-actions.component.spec.ts | 18 ++- src/app/storage/storage-api.service.spec.ts | 142 +++++++++++++++++ src/app/storage/storage-api.service.ts | 10 +- 21 files changed, 795 insertions(+), 33 deletions(-) create mode 100644 src/app/fork-me/fork-me.component.html create mode 100644 src/app/fork-me/fork-me.component.scss create mode 100644 src/app/fork-me/fork-me.component.spec.ts create mode 100644 src/app/fork-me/fork-me.component.ts create mode 100644 src/app/fork-me/index.ts create mode 100644 src/app/storage/storage-actions/edit-form-folder/edit-form-folder.component.spec.ts create mode 100644 src/app/storage/storage-actions/edit-form-secret/edit-form-secret.component.spec.ts create mode 100644 src/app/storage/storage-actions/edit-form/edit-form.component.spec.ts create mode 100644 src/app/storage/storage-actions/edit-form/edit-form.service.spec.ts create mode 100644 src/app/storage/storage-api.service.spec.ts diff --git a/package.json b/package.json index 0568017..00e2a95 100644 --- a/package.json +++ b/package.json @@ -13,15 +13,15 @@ "private": true, "dependencies": { "@angular-devkit/build-angular": "^0.6.1", - "@angular/animations": "6.0.0", - "@angular/common": "6.0.0", - "@angular/compiler": "6.0.0", - "@angular/core": "6.0.0", - "@angular/forms": "6.0.0", - "@angular/http": "6.0.0", - "@angular/platform-browser": "6.0.0", - "@angular/platform-browser-dynamic": "6.0.0", - "@angular/router": "6.0.0", + "@angular/animations": "6.0.2", + "@angular/common": "6.0.2", + "@angular/compiler": "6.0.2", + "@angular/core": "6.0.2", + "@angular/forms": "6.0.2", + "@angular/http": "6.0.2", + "@angular/platform-browser": "6.0.2", + "@angular/platform-browser-dynamic": "6.0.2", + "@angular/router": "6.0.2", "@types/crypto-js": "^3.1.39", "@types/jasmine": "^2.8.7", "bootstrap": "^3.3.7", @@ -37,9 +37,9 @@ "zone.js": "^0.8.26" }, "devDependencies": { - "@angular/cli": "6.0.1", - "@angular/compiler-cli": "6.0.0", - "@angular/language-service": "6.0.0", + "@angular/cli": "6.0.3", + "@angular/compiler-cli": "6.0.2", + "@angular/language-service": "6.0.2", "@types/crypto-js": "^3.1.37", "@types/jasmine": "~2.8.2", "@types/jasminewd2": "~2.0.2", @@ -54,10 +54,10 @@ "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "karma-phantomjs-launcher": "^1.0.4", - "phantomjs": "^2.1.7", + "phantomjs-prebuilt": "^2.1.7", "protractor": "~5.2.0", "ts-node": "~3.3.0", "tslint": "~5.8.0", "typescript": "2.7.2" } -} +} \ No newline at end of file diff --git a/src/app/auth/auth.module.ts b/src/app/auth/auth.module.ts index d1b66a3..6cdb551 100644 --- a/src/app/auth/auth.module.ts +++ b/src/app/auth/auth.module.ts @@ -7,6 +7,7 @@ import { AuthRoutingModule } from './auth-routing.module'; import { AuthGuard } from './auth.guard'; import { AuthInterceptor } from './auth.interceptor'; import { AuthService } from './auth.service'; +import { ForkMeComponent } from '../fork-me'; import { LoginComponent, RegexpErrorComponent } from './login'; import { LogoutComponent } from './logout'; @@ -27,6 +28,7 @@ import { LogoutComponent } from './logout'; } ], declarations: [ + ForkMeComponent, LoginComponent, LogoutComponent, RegexpErrorComponent diff --git a/src/app/auth/auth.service.ts b/src/app/auth/auth.service.ts index 40616a1..83c2176 100644 --- a/src/app/auth/auth.service.ts +++ b/src/app/auth/auth.service.ts @@ -74,6 +74,7 @@ export class AuthService { logOut() { this.encrypting.setUser(null); this.session = null; + sessionStorage.removeItem('session'); this.subject.next(); } diff --git a/src/app/auth/login/login.component.html b/src/app/auth/login/login.component.html index bd17d83..f2b727e 100644 --- a/src/app/auth/login/login.component.html +++ b/src/app/auth/login/login.component.html @@ -1,3 +1,4 @@ +
diff --git a/src/app/auth/login/login.component.spec.ts b/src/app/auth/login/login.component.spec.ts index 74b3858..d4abb86 100644 --- a/src/app/auth/login/login.component.spec.ts +++ b/src/app/auth/login/login.component.spec.ts @@ -47,6 +47,12 @@ describe('LoginComponent', () => { @Component({ template: '' }) class DummyComponent {} + @Component({ + selector: 'app-fork-me', + template: '
Fake fork me component
' + }) + class FakeForkMeComponent {} + beforeEach(async(() => { authSubject = new Subject(); authServiceStub = { @@ -70,6 +76,7 @@ describe('LoginComponent', () => { ]) ], declarations: [ + FakeForkMeComponent, LoginComponent, DummyComponent, RegexpErrorComponent diff --git a/src/app/fork-me/fork-me.component.html b/src/app/fork-me/fork-me.component.html new file mode 100644 index 0000000..d4c9ba5 --- /dev/null +++ b/src/app/fork-me/fork-me.component.html @@ -0,0 +1,32 @@ + + + \ No newline at end of file diff --git a/src/app/fork-me/fork-me.component.scss b/src/app/fork-me/fork-me.component.scss new file mode 100644 index 0000000..49fce8f --- /dev/null +++ b/src/app/fork-me/fork-me.component.scss @@ -0,0 +1,24 @@ +.github-corner:hover .octo-arm { + animation: octocat-wave 560ms ease-in-out; +} + +@keyframes octocat-wave { + 0%, 100% { + transform: rotate(0); + } + 20%, 60% { + transform: rotate(-25deg); + } + 40%, 80% { + transform: rotate(10deg); + } +} + +@media (max-width: 500px) { + .github-corner:hover .octo-arm { + animation: none; + } + .github-corner .octo-arm { + animation: octocat-wave 560ms ease-in-out; + } +} \ No newline at end of file diff --git a/src/app/fork-me/fork-me.component.spec.ts b/src/app/fork-me/fork-me.component.spec.ts new file mode 100644 index 0000000..53ea752 --- /dev/null +++ b/src/app/fork-me/fork-me.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ForkMeComponent } from './fork-me.component'; + +describe('ForkMeComponent', () => { + let component: ForkMeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ForkMeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ForkMeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/fork-me/fork-me.component.ts b/src/app/fork-me/fork-me.component.ts new file mode 100644 index 0000000..705e0f4 --- /dev/null +++ b/src/app/fork-me/fork-me.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-fork-me', + templateUrl: './fork-me.component.html', + styleUrls: ['./fork-me.component.scss'] +}) +export class ForkMeComponent { + @Input() public url; + constructor() { } +} diff --git a/src/app/fork-me/index.ts b/src/app/fork-me/index.ts new file mode 100644 index 0000000..cdd0cae --- /dev/null +++ b/src/app/fork-me/index.ts @@ -0,0 +1 @@ +export * from './fork-me.component'; diff --git a/src/app/navigation/navigation.component.html b/src/app/navigation/navigation.component.html index 9607eec..73f813b 100644 --- a/src/app/navigation/navigation.component.html +++ b/src/app/navigation/navigation.component.html @@ -12,10 +12,6 @@ - -   - Key Holder -