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
diff --git a/src/app/password-generator/password-generator.service.spec.ts b/src/app/password-generator/password-generator.service.spec.ts
index 55638ed..473ea9a 100644
--- a/src/app/password-generator/password-generator.service.spec.ts
+++ b/src/app/password-generator/password-generator.service.spec.ts
@@ -1,15 +1,69 @@
import { TestBed, inject } from '@angular/core/testing';
+import { Options } from './model';
import { PasswordGeneratorService } from './password-generator.service';
describe('PasswordGeneratorService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [PasswordGeneratorService]
+ let service: PasswordGeneratorService;
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [PasswordGeneratorService]
+ });
});
- });
- it('should be created', inject([PasswordGeneratorService], (service: PasswordGeneratorService) => {
- expect(service).toBeTruthy();
- }));
+ beforeEach(inject([PasswordGeneratorService], (_service: PasswordGeneratorService) => {
+ service = _service;
+ }));
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+
+ it('should generate passwords with default options', () => {
+ const options = new Options();
+ expect(options.length).toEqual(20);
+ expect(service.generate().length).toEqual(options.length);
+ });
+
+ it('should raise error with wrong options', () => {
+ const options = new Options(10, false, false, false, false);
+ expect(options.length).toEqual(10);
+ const expectedError = new Error('Invalid options for the password generator');
+ expect(() => service.generate(options)).toThrow(expectedError);
+ });
+
+ it('should raise error when length is 0', () => {
+ const options = new Options(0);
+ expect(options.length).toEqual(0);
+ const expectedError = new Error('Invalid options for the password generator');
+ expect(() => service.generate(options)).toThrow(expectedError);
+ });
+
+ it('should generate numeric passwords', () => {
+ const options = new Options(10, true, false, false, false);
+ const secret = service.generate(options);
+ expect(secret.length).toEqual(options.length);
+ expect((/^\d+$/).test(secret)).toBeTruthy();
+ });
+
+ it('should generate symbols passwords', () => {
+ const options = new Options(20, false, true, false, false);
+ const secret = service.generate(options);
+ expect(secret.length).toEqual(options.length);
+ expect((/^[\D\W]+$/).test(secret)).toBeTruthy();
+ });
+
+ it('should generate lowercase passwords', () => {
+ const options = new Options(20, false, false, true, false);
+ const secret = service.generate(options);
+ expect(secret.length).toEqual(options.length);
+ expect((/^[a-z]+$/).test(secret)).toBeTruthy();
+ });
+
+ it('should generate uppercase passwords', () => {
+ const options = new Options(20, false, false, false, true);
+ const secret = service.generate(options);
+ expect(secret.length).toEqual(options.length);
+ expect((/^[A-Z]+$/).test(secret)).toBeTruthy();
+ });
});
diff --git a/src/app/password-generator/password-generator.service.ts b/src/app/password-generator/password-generator.service.ts
index b94d1ec..940599b 100644
--- a/src/app/password-generator/password-generator.service.ts
+++ b/src/app/password-generator/password-generator.service.ts
@@ -35,7 +35,7 @@ export class PasswordGeneratorService {
// Generate character pool
const availableCharacters = this.getAvailableCharacters(options);
- if (!availableCharacters) {
+ if (!availableCharacters || (options.length <= 0)) {
throw new Error('Invalid options for the password generator');
}
diff --git a/src/app/storage/storage-actions/edit-form-folder/edit-form-folder.component.spec.ts b/src/app/storage/storage-actions/edit-form-folder/edit-form-folder.component.spec.ts
new file mode 100644
index 0000000..9ea97b5
--- /dev/null
+++ b/src/app/storage/storage-actions/edit-form-folder/edit-form-folder.component.spec.ts
@@ -0,0 +1,97 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { FormsModule } from '@angular/forms';
+import { Subject } from 'rxjs/index';
+
+import { Folder } from '../../model';
+import { StorageService } from '../../storage.service';
+import { EditFormFolderComponent } from './edit-form-folder.component';
+import { EditFormFolderService } from './edit-form-folder.service';
+
+describe('EditFormFolderComponent', () => {
+ let component: EditFormFolderComponent,
+ fixture: ComponentFixture,
+ storageCurrent: Folder,
+ storageServiceMock,
+ editEventSubject,
+ editFormFolderService;
+
+ beforeEach(async(() => {
+ storageCurrent = new Folder('current');
+ storageServiceMock = {
+ getCurrent: jasmine.createSpy().and.returnValue(storageCurrent),
+ openFolder: jasmine.createSpy(),
+ save: jasmine.createSpy()
+ };
+ editEventSubject = new Subject