From a4f10bf1f8f5e6ac472be9ad37eeda107237b7c6 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Fri, 7 Jun 2019 14:12:34 -0700 Subject: [PATCH 1/9] #49 basic npm run test tooling fix --- angular.json | 51 -------------------------------------- src/lib/sdk.module.spec.ts | 25 +++++++++++++++++++ src/test.ts | 2 +- src/tsconfig.spec.json | 2 +- 4 files changed, 27 insertions(+), 53 deletions(-) create mode 100644 src/lib/sdk.module.spec.ts diff --git a/angular.json b/angular.json index dc63ec4e..3f8a50f3 100644 --- a/angular.json +++ b/angular.json @@ -131,23 +131,6 @@ "browserTarget": "example/search-with-results-and-details:build" } }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "examples/search-with-results-and-details/src/test.ts", - "polyfills": "examples/search-with-results-and-details/src/polyfills.ts", - "tsConfig": "examples/search-with-results-and-details/tsconfig.spec.json", - "karmaConfig": "examples/search-with-results-and-details/karma.conf.js", - "styles": [ - "examples/search-with-results-and-details/src/styles.scss" - ], - "scripts": [], - "assets": [ - "examples/search-with-results-and-details/src/favicon.ico", - "examples/search-with-results-and-details/src/assets" - ] - } - }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { @@ -232,23 +215,6 @@ "browserTarget": "example/search-with-spinner:build" } }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "examples/search-with-spinner/src/test.ts", - "polyfills": "examples/search-with-spinner/src/polyfills.ts", - "tsConfig": "examples/search-with-spinner/tsconfig.spec.json", - "karmaConfig": "examples/search-with-spinner/karma.conf.js", - "styles": [ - "examples/search-with-spinner/src/styles.css" - ], - "scripts": [], - "assets": [ - "examples/search-with-spinner/src/favicon.ico", - "examples/search-with-spinner/src/assets" - ] - } - }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { @@ -337,23 +303,6 @@ "browserTarget": "example/graph:build" } }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "examples/graph/src/test.ts", - "polyfills": "examples/graph/src/polyfills.ts", - "tsConfig": "examples/graph/tsconfig.spec.json", - "karmaConfig": "examples/graph/karma.conf.js", - "styles": [ - "examples/graph/src/styles.scss" - ], - "scripts": [], - "assets": [ - "examples/graph/src/favicon.ico", - "examples/graph/src/assets" - ] - } - }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { diff --git a/src/lib/sdk.module.spec.ts b/src/lib/sdk.module.spec.ts new file mode 100644 index 00000000..7b466895 --- /dev/null +++ b/src/lib/sdk.module.spec.ts @@ -0,0 +1,25 @@ +import { TestBed } from '@angular/core/testing'; + +import { SenzingSdkModule } from './sdk.module'; + +//import { CustomHttp } from './custom-http.service'; + +describe(`SenzingSdkModule`, () => { + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [ SenzingSdkModule.forRoot() ] + }); + }); + + //it(`should not provide 'CustomHttp' service`, () => { + // expect(() => TestBed.get(CustomHttp)).toThrowError(/No provider for/); + //}); + + it(`should be truthy`, () => { + expect(() => { + return true; + }); + }) + +}); diff --git a/src/test.ts b/src/test.ts index e11ff1c9..26f6e154 100644 --- a/src/test.ts +++ b/src/test.ts @@ -17,6 +17,6 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting() ); // Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); +const context = require.context('./', true, /sdk\.module\.spec\.ts$/); // And load the modules. context.keys().map(context); diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json index 642e0689..c1645db5 100644 --- a/src/tsconfig.spec.json +++ b/src/tsconfig.spec.json @@ -8,7 +8,7 @@ ] }, "files": [ - "src/test.ts" + "test.ts" ], "include": [ "**/*.spec.ts", From 2f31ec3ddc1173499dfbeaaa1efa7db75b9afb37 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 09:12:25 -0700 Subject: [PATCH 2/9] #49 explicit visibility and safety checks --- ...sz-search-result-card-content.component.ts | 58 ++++++++++++------- .../sz-search-result-card.component.ts | 4 +- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.ts b/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.ts index 100353fc..0760a5d9 100644 --- a/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.ts +++ b/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.ts @@ -13,9 +13,9 @@ import { SzRelatedEntity, SzEntityRecord } from '@senzing/rest-api-client-ng'; styleUrls: ['./sz-search-result-card-content.component.scss'] }) export class SzSearchResultCardContentComponent implements OnInit { - @Input() entity: SzEntityDetailSectionData; - @Input() maxLinesToDisplay = 3; - @Input() showAllInfo: boolean; + @Input() public entity: SzEntityDetailSectionData; + @Input() public maxLinesToDisplay = 3; + @Input() public showAllInfo: boolean; @ViewChild('columnOne') private columnOne: ElementRef; @@ -56,25 +56,27 @@ export class SzSearchResultCardContentComponent implements OnInit { // ----------------- start total getters ------------------- get columnTwoTotal(): number { - return (this.nameData.concat(this.attributeData).length); + const totalData = this.getNameAndAttributeData(this.nameData, this.attributeData); + return totalData && totalData.length ? totalData.length : 0; } get showColumnTwo(): boolean { return (this.columnTwoTotal > 0); } get columnThreeTotal(): number { - return (this.addressData.concat(this.phoneData).length); + const totalData = this.getAddressAndPhoneData(this.addressData, this.phoneData); + return totalData && totalData.length ? totalData.length : 0; } get showColumnThree(): boolean { return (this.columnThreeTotal > 0); } get columnFourTotal(): number { - return this.identifierData.length; + return this.identifierData ? this.identifierData.length : 0; } public get showColumnFour(): boolean { - return this.identifierData.length > 0; + return this.identifierData ? this.identifierData.length > 0 : false; } get columnFiveTotal(): number { - return this.otherData.length; + return this.otherData ? this.otherData.length : 0; } get showColumnFive(): boolean { return (this.columnFiveTotal > 0); @@ -82,31 +84,47 @@ export class SzSearchResultCardContentComponent implements OnInit { // ----------------- end total getters ------------------- getNameAndAttributeData(nameData: string[], attributeData: string[]): string[] { - return nameData.concat(attributeData); + if(nameData && nameData.concat && attributeData) { + return nameData.concat(attributeData); + } else if(nameData) { + return nameData; + } else if(attributeData) { + return attributeData; + } + return []; } getAddressAndPhoneData(addressData: string[], phoneData: string[]): string[] { + if(addressData && addressData.concat && phoneData) { + return addressData.concat(phoneData); + } else if(addressData) { + return addressData; + } else if(phoneData) { + return phoneData; + } + return []; + return addressData.concat(phoneData); } - get nameData(): string[] { - return this.entity.nameData; + get nameData(): string[] | undefined { + return this.entity && this.entity.nameData ? this.entity.nameData : undefined; } - get attributeData(): string[] { - return this.entity.attributeData; + get attributeData(): string[] | undefined { + return this.entity && this.entity.attributeData ? this.entity.attributeData : undefined; } - get addressData(): string[] { - return this.entity.addressData; + get addressData(): string[] | undefined { + return this.entity && this.entity.addressData ? this.entity.addressData : undefined; } - get phoneData(): string[] { - return this.entity.phoneData; + get phoneData(): string[] | undefined { + return this.entity && this.entity.phoneData ? this.entity.phoneData : undefined; } - get identifierData(): string[] { - return this.entity.identifierData; + get identifierData(): string[] | undefined { + return this.entity && this.entity.identifierData ? this.entity.identifierData : undefined; } get otherData(): string[] { @@ -127,7 +145,7 @@ export class SzSearchResultCardContentComponent implements OnInit { } private getEntityRecord(obj: any): SzEntityRecord { - if (obj.otherData !== undefined) { + if (obj && obj.otherData !== undefined) { return {...obj} as SzEntityRecord; } else { return {} as SzEntityRecord; diff --git a/src/lib/search/sz-search-result-card/sz-search-result-card.component.ts b/src/lib/search/sz-search-result-card/sz-search-result-card.component.ts index c03f811a..e2cb53ad 100644 --- a/src/lib/search/sz-search-result-card/sz-search-result-card.component.ts +++ b/src/lib/search/sz-search-result-card/sz-search-result-card.component.ts @@ -24,7 +24,9 @@ export class SzSearchResultCardComponent implements OnInit { constructor() { } ngOnInit() { - this.showRecordId.fill(false, this.searchResult.records.length); + if(this.searchResult) { + this.showRecordId.fill(false, this.searchResult.records.length); + } } toggleShowRecordId(index: number): void { From 86e2624e007b5722b66ef85f1b014593caa5fcc2 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 09:13:04 -0700 Subject: [PATCH 3/9] changed allowedOrigins to '*' --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2130de7b..73b043bb 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "publish": "cd ./dist/@senzing/sdk-components-ng/ && npm publish --access restricted", "watch": "rm -fR dist/@senzing/sdk-components-ng && concurrently --kill-others \"wait-on file:dist/@senzing/sdk-components-ng/public_api.d.ts && ng serve\" \"ng build @senzing/sdk-components-ng --watch\"", "test": "ng test", - "start:server": "java -jar \"../senzing-api-server/target/senzing-api-server-1.6.0.jar\" -iniFile \"%LOCALAPPDATA%\\Senzing\\Workbench\\project_1\\g2.ini\" -allowedOrigins http://localhost:4300", + "start:server": "java -jar \"../senzing-api-server/target/senzing-api-server-1.6.0.jar\" -iniFile \"%LOCALAPPDATA%\\Senzing\\Workbench\\project_1\\g2.ini\" -allowedOrigins '*'", "start:rest": "npm run start:server", "server": "npm run start:server", "lint": "ng lint", From 0530b11eaada45c9a5b9367f55eaf17d43bcf0a8 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 09:14:36 -0700 Subject: [PATCH 4/9] #49 wip --- .../sz-configuration-about.component.spec.ts | 3 ++- .../sz-configuration.component.spec.ts | 3 ++- ...arch-result-card-content.component.spec.ts | 3 ++- ...earch-result-card-header.component.spec.ts | 5 +++-- .../sz-search-result-card-header.component.ts | 20 +++++++++---------- .../sz-search-result-card.component.spec.ts | 3 ++- .../sz-search-results.component.spec.ts | 4 +++- .../sz-search/sz-search.component.spec.ts | 4 +++- src/lib/services/sz-search.service.spec.ts | 7 +++++-- .../sz-powered-by.component.spec.ts | 3 ++- src/test.ts | 16 ++++++++++++++- 11 files changed, 49 insertions(+), 22 deletions(-) diff --git a/src/lib/configuration/sz-configuration-about/sz-configuration-about.component.spec.ts b/src/lib/configuration/sz-configuration-about/sz-configuration-about.component.spec.ts index d01d8f58..c39841ae 100644 --- a/src/lib/configuration/sz-configuration-about/sz-configuration-about.component.spec.ts +++ b/src/lib/configuration/sz-configuration-about/sz-configuration-about.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzConfigurationAboutComponent } from './sz-configuration-about.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzConfigurationAboutComponent', () => { let component: SzConfigurationAboutComponent; @@ -8,7 +9,7 @@ describe('SzConfigurationAboutComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzConfigurationAboutComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/configuration/sz-configuration/sz-configuration.component.spec.ts b/src/lib/configuration/sz-configuration/sz-configuration.component.spec.ts index 8ea309f4..d971db3e 100644 --- a/src/lib/configuration/sz-configuration/sz-configuration.component.spec.ts +++ b/src/lib/configuration/sz-configuration/sz-configuration.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzConfigurationComponent } from './sz-configuration.component'; +import { SenzingSdkModule } from '../../sdk.module'; describe('SzConfigurationComponent', () => { let component: SzConfigurationComponent; @@ -8,7 +9,7 @@ describe('SzConfigurationComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzConfigurationComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.spec.ts b/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.spec.ts index 39589cde..07b0b71d 100644 --- a/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.spec.ts +++ b/src/lib/search/sz-search-result-card/sz-search-result-card-content/sz-search-result-card-content.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzSearchResultCardContentComponent } from './sz-search-result-card-content.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzSearchResultCardContentComponent', () => { let component: SzSearchResultCardContentComponent; @@ -8,7 +9,7 @@ describe('SzSearchResultCardContentComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzSearchResultCardContentComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.spec.ts b/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.spec.ts index 9d2b7dfc..f37ab3aa 100644 --- a/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.spec.ts +++ b/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.spec.ts @@ -1,14 +1,15 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzSearchResultCardHeaderComponent } from './sz-search-result-card-header.component'; - +import { SenzingSdkModule } from 'src/lib/sdk.module'; +// describe('SzSearchResultCardHeaderComponent', () => { let component: SzSearchResultCardHeaderComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzSearchResultCardHeaderComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.ts b/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.ts index 3d2661a7..98b239a1 100644 --- a/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.ts +++ b/src/lib/search/sz-search-result-card/sz-search-result-card-header/sz-search-result-card-header.component.ts @@ -15,34 +15,34 @@ export class SzSearchResultCardHeaderComponent implements OnInit { @Input() showDataSources: boolean = true; - @Input() - set searchResult(value: SzAttributeSearchResult) { + @Input() public set searchResult(value: SzAttributeSearchResult) { this._searchResult = value; //console.log('sz-search-result-card-header.setSearchResult: ', this._searchResult); } - get searchResult(): SzAttributeSearchResult { + public get searchResult(): SzAttributeSearchResult { return this._searchResult; } - @Input() searchValue: string; - @Input() hideBackGroundColor: boolean; - @Input() entityData: SzEntityRecord; + + @Input() public searchValue: string; + @Input() public hideBackGroundColor: boolean; + @Input() public entityData: SzEntityRecord; alert = false; - get recordSummariesExist(): boolean { + public get recordSummariesExist(): boolean { if(this.searchResult && this.searchResult.recordSummaries){ return this.searchResult.recordSummaries.length > 0; } return false } - get recordSummaries(): SzDataSourceRecordSummary[] | boolean { + public get recordSummaries(): SzDataSourceRecordSummary[] | boolean { if(this.searchResult && this.searchResult.recordSummaries){ return this.searchResult.recordSummaries; } return false } - get entityDetailsLinkName(): string { + public get entityDetailsLinkName(): string { //console.log('sz-search-result-card-header.getEntityDetailsLinkName: ', this._searchResult); if (this._searchResult && this._searchResult.entityName) { return this._searchResult.entityName; @@ -51,7 +51,7 @@ export class SzSearchResultCardHeaderComponent implements OnInit { } } - get entityDetailsLink(): string | boolean { + public get entityDetailsLink(): string | boolean { if (this._searchResult && this._searchResult.entityId) { return `/search/details/${this._searchResult.entityId}`; } else if(this._searchResult && this._searchResult.entityId ) { diff --git a/src/lib/search/sz-search-result-card/sz-search-result-card.component.spec.ts b/src/lib/search/sz-search-result-card/sz-search-result-card.component.spec.ts index 6d29b485..732ffdb4 100644 --- a/src/lib/search/sz-search-result-card/sz-search-result-card.component.spec.ts +++ b/src/lib/search/sz-search-result-card/sz-search-result-card.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzSearchResultCardComponent } from './sz-search-result-card.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SearchResultCardComponent', () => { let component: SzSearchResultCardComponent; @@ -8,7 +9,7 @@ describe('SearchResultCardComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzSearchResultCardComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/search/sz-search-results/sz-search-results.component.spec.ts b/src/lib/search/sz-search-results/sz-search-results.component.spec.ts index b193acf3..0e873b29 100644 --- a/src/lib/search/sz-search-results/sz-search-results.component.spec.ts +++ b/src/lib/search/sz-search-results/sz-search-results.component.spec.ts @@ -1,6 +1,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzSearchResultsComponent } from './sz-search-results.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; + describe('SzSearchResultsComponent', () => { let component: SzSearchResultsComponent; @@ -8,7 +10,7 @@ describe('SzSearchResultsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzSearchResultsComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/search/sz-search/sz-search.component.spec.ts b/src/lib/search/sz-search/sz-search.component.spec.ts index 7645acf5..44282a2d 100644 --- a/src/lib/search/sz-search/sz-search.component.spec.ts +++ b/src/lib/search/sz-search/sz-search.component.spec.ts @@ -1,6 +1,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzSearchComponent } from './sz-search.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; + describe('SzSearchComponent', () => { let component: SzSearchComponent; @@ -8,7 +10,7 @@ describe('SzSearchComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzSearchComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/services/sz-search.service.spec.ts b/src/lib/services/sz-search.service.spec.ts index 6fea6e0f..f54cd9f2 100644 --- a/src/lib/services/sz-search.service.spec.ts +++ b/src/lib/services/sz-search.service.spec.ts @@ -1,9 +1,12 @@ import { TestBed } from '@angular/core/testing'; import { SzSearchService } from './sz-search.service'; - +import { SenzingSdkModule } from 'src/lib/sdk.module'; +// describe('SzSearchService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({ + imports: [SenzingSdkModule.forRoot()] + })); it('should be created', () => { const service: SzSearchService = TestBed.get(SzSearchService); diff --git a/src/lib/sz-powered-by/sz-powered-by.component.spec.ts b/src/lib/sz-powered-by/sz-powered-by.component.spec.ts index 3c1c0e3d..ed01a15f 100644 --- a/src/lib/sz-powered-by/sz-powered-by.component.spec.ts +++ b/src/lib/sz-powered-by/sz-powered-by.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzPoweredByComponent } from './sz-powered-by.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzPoweredByComponent', () => { let component: SzPoweredByComponent; @@ -8,7 +9,7 @@ describe('SzPoweredByComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzPoweredByComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/test.ts b/src/test.ts index 26f6e154..57c94a60 100644 --- a/src/test.ts +++ b/src/test.ts @@ -17,6 +17,20 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting() ); // Then we find all the tests. -const context = require.context('./', true, /sdk\.module\.spec\.ts$/); +//const context = require.context('./', true, /\.spec\.ts$/); + +// config +const context = require.context('./lib/configuration', true, /\.spec\.ts$/); +// search +const context2 = require.context('./lib/search', true, /\.spec\.ts$/); +// entity +const context3 = require.context('./lib/entity', true, /\.spec\.ts$/); + +// powered by +const context5 = require.context('./lib/sz-powered-by', true, /\.spec\.ts$/); + // And load the modules. context.keys().map(context); +context2.keys().map(context2); +//context3.keys().map(context3); +context5.keys().map(context5); From 26b78263f55cbf1ede40d4f08fc1d43ef794ded0 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 10:06:56 -0700 Subject: [PATCH 5/9] template/asset refactoring correction --- .../header.component.ts | 4 +- .../sz-entity-detail-header.component.html | 24 ----- .../sz-entity-detail-header.component.scss | 48 ---------- .../sz-entity-detail-header.component.spec.ts | 25 ----- .../sz-entity-detail-header.component.ts | 95 ------------------- 5 files changed, 2 insertions(+), 194 deletions(-) delete mode 100644 src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.html delete mode 100644 src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.scss delete mode 100644 src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.spec.ts delete mode 100644 src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.ts diff --git a/src/lib/entity/detail/sz-entity-detail-header/header.component.ts b/src/lib/entity/detail/sz-entity-detail-header/header.component.ts index 71476d40..19df6ab1 100644 --- a/src/lib/entity/detail/sz-entity-detail-header/header.component.ts +++ b/src/lib/entity/detail/sz-entity-detail-header/header.component.ts @@ -15,8 +15,8 @@ import { */ @Component({ selector: 'sz-entity-detail-header', - templateUrl: './sz-entity-detail-header.component.html', - styleUrls: ['./sz-entity-detail-header.component.scss'] + templateUrl: './header.component.html', + styleUrls: ['./header.component.scss'] }) export class SzEntityDetailHeaderComponent implements OnInit { @Input() public searchTerm: string; diff --git a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.html b/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.html deleted file mode 100644 index 890c5e5d..00000000 --- a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.html +++ /dev/null @@ -1,24 +0,0 @@ -
-
- - - - - -
-
{{entity?.resolvedEntity?.bestName | titlecase}}
- -
- - -
-
-
-
- -
-
diff --git a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.scss b/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.scss deleted file mode 100644 index 774c664e..00000000 --- a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.scss +++ /dev/null @@ -1,48 +0,0 @@ -.icon { - display: inline-block; - width: 1em; - height: 1em; - stroke-width: 0; - stroke: currentColor; - fill: currentColor; -} - -.icon-flip { - transform: rotate(180deg); -} - -:host { - display: var(--sz-entity-detail-header-display); - flex-direction: column; - font-family: var(--sz-entity-detail-header-font-family); - font-size: var(--sz-entity-detail-header-font-size); - color: var(--sz-entity-detail-header-color); - - - .detail-header__top--wrapper { - .icon-user { - /*border: 3px solid $sz-grey;*/ - border: var(--sz-entity-detail-icon-border); - border-radius: var(--sz-entity-detail-icon-border-radius); - height: var(--sz-entity-detail-icon-height); - width: var(--sz-entity-detail-icon-width); - display: var(--sz-entity-detail-icon-display); - margin: var(--sz-entity-detail-icon-margin); - overflow: hidden; - } - display: flex; - - .detail-header__section-summary--wrapper { - display: flex; - - margin: 30px 0 0 0; - } - .detail-header__entity-name { - font-size: var(--sz-entity-detail-header-entity-name-font-size); - font-weight: var(--sz-entity-detail-header-entity-name-font-weight); - } - .detail-header__last-seen { - font-size: 24px; - } - } -} diff --git a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.spec.ts b/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.spec.ts deleted file mode 100644 index 722a25f9..00000000 --- a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SzEntityDetailHeaderComponent } from './sz-entity-detail-header.component'; - -describe('SzEntityDetailHeaderComponent', () => { - let component: SzEntityDetailHeaderComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SzEntityDetailHeaderComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SzEntityDetailHeaderComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.ts b/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.ts deleted file mode 100644 index 71476d40..00000000 --- a/src/lib/entity/detail/sz-entity-detail-header/sz-entity-detail-header.component.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { SzEntityDetailSectionSummary } from '../../../models/entity-detail-section-data'; - - -import { - SzEntityData, - SzRelatedEntity, - SzEntityRecord, - SzRelationshipType -} from '@senzing/rest-api-client-ng'; - -/** - * @internal - * @export - */ -@Component({ - selector: 'sz-entity-detail-header', - templateUrl: './sz-entity-detail-header.component.html', - styleUrls: ['./sz-entity-detail-header.component.scss'] -}) -export class SzEntityDetailHeaderComponent implements OnInit { - @Input() public searchTerm: string; - @Input() public entity: SzEntityData; - -/** - * A list of the search results that are matches. - * @readonly - */ - public get matches(): SzEntityRecord[] { - return this.entity && this.entity.resolvedEntity.records ? this.entity.resolvedEntity.records : undefined; - } - /** - * A list of the search results that are possible matches. - * - * @readonly - */ - public get possibleMatches(): SzRelatedEntity[] { - return this.entity && this.entity.relatedEntities.filter ? this.entity.relatedEntities.filter( (sr) => { - return sr.relationType == SzRelationshipType.POSSIBLEMATCH; - }) : undefined; - } - /** - * A list of the search results that are related. - * - * @readonly - */ - public get discoveredRelationships(): SzRelatedEntity[] { - return this.entity && this.entity.relatedEntities.filter ? this.entity.relatedEntities.filter( (sr) => { - return sr.relationType == SzRelationshipType.POSSIBLERELATION; - }) : undefined; - } - /** - * A list of the search results that are name only matches. - * - * @readonly - */ - public get disclosedRelationships(): SzRelatedEntity[] { - - return this.entity && this.entity.relatedEntities.filter ? this.entity.relatedEntities.filter( (sr) => { - return sr.relationType == SzRelationshipType.DISCLOSEDRELATION; - }) : undefined; - } - - - - constructor() { - } - - ngOnInit() {} - - get sectionSummaryInfo(): SzEntityDetailSectionSummary[] { - if (this.entity) { - return [ - { - total: this.entity.resolvedEntity.records.length, - title: 'Matched Record'+ (this.entity.resolvedEntity.records.length === 1 ? '' : 's') - }, - { - total: this.possibleMatches.length, - title: 'Possible Match'+ (this.possibleMatches.length === 1 ? '' : 'es') - }, - { - total: this.discoveredRelationships.length, - title: 'Possible Relationship'+ (this.discoveredRelationships.length === 1 ? '' : 's') - }, - { - total: this.disclosedRelationships.length, - title: 'Disclosed Relationship'+ (this.disclosedRelationships.length === 1 ? '' : 's') - }, - ]; - } - return []; - } - -} From cda9380439abdba88cba6056d1d0b9304ec8b5cd Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 10:07:46 -0700 Subject: [PATCH 6/9] #49 wip. safety checks --- .../sz-entity-detail-header/content.component.spec.ts | 3 ++- .../sz-entity-detail-header/header.component.spec.ts | 3 ++- .../sz-entity-detail-header/summary.component.spec.ts | 3 ++- src/lib/entity/detail/sz-entity-detail.component.spec.ts | 3 ++- .../collapsible-card.component.html | 2 +- .../collapsible-card.component.spec.ts | 3 ++- .../collapsible-card.component.ts | 2 +- .../sz-entity-details-section/header.component.spec.ts | 3 ++- .../detail/sz-entity-details-section/header.component.ts | 9 +++++---- .../sz-entity-details-section.component.spec.ts | 3 ++- .../sz-entity-details-section.component.ts | 1 + .../sz-entity-match-pill.component.spec.ts | 3 ++- .../sz-entity-record-card-content.component.spec.ts | 3 ++- .../sz-entity-record-card-header.component.spec.ts | 3 ++- .../sz-entity-record-card.component.spec.ts | 3 ++- src/test.ts | 2 +- 16 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/lib/entity/detail/sz-entity-detail-header/content.component.spec.ts b/src/lib/entity/detail/sz-entity-detail-header/content.component.spec.ts index 786852a0..53e09e7a 100644 --- a/src/lib/entity/detail/sz-entity-detail-header/content.component.spec.ts +++ b/src/lib/entity/detail/sz-entity-detail-header/content.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityDetailHeaderContentComponent } from './content.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityDetailHeaderContentComponent', () => { let component: SzEntityDetailHeaderContentComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailHeaderContentComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailHeaderContentComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-detail-header/header.component.spec.ts b/src/lib/entity/detail/sz-entity-detail-header/header.component.spec.ts index e804f962..3cdf29dd 100644 --- a/src/lib/entity/detail/sz-entity-detail-header/header.component.spec.ts +++ b/src/lib/entity/detail/sz-entity-detail-header/header.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityDetailHeaderComponent } from './header.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityDetailHeaderComponent', () => { let component: SzEntityDetailHeaderComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailHeaderComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailHeaderComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-detail-header/summary.component.spec.ts b/src/lib/entity/detail/sz-entity-detail-header/summary.component.spec.ts index e0579dfe..5298a106 100644 --- a/src/lib/entity/detail/sz-entity-detail-header/summary.component.spec.ts +++ b/src/lib/entity/detail/sz-entity-detail-header/summary.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityDetailSectionSummaryComponent } from './summary.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityDetailSectionSummaryComponent', () => { let component: SzEntityDetailSectionSummaryComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailSectionSummaryComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailSectionSummaryComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-detail.component.spec.ts b/src/lib/entity/detail/sz-entity-detail.component.spec.ts index bf18790e..0d182e64 100644 --- a/src/lib/entity/detail/sz-entity-detail.component.spec.ts +++ b/src/lib/entity/detail/sz-entity-detail.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityDetailComponent } from './sz-entity-detail.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityDetailComponent', () => { let component: SzEntityDetailComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.html b/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.html index 5edff9a2..4b7799fa 100644 --- a/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.html +++ b/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.html @@ -15,7 +15,7 @@ - {{cardData.dataSource}} + {{cardData?.dataSource}} { let component: SzEntityDetailSectionCollapsibleCardComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailSectionCollapsibleCardComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailSectionCollapsibleCardComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.ts b/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.ts index ba380f93..edf7fcb5 100644 --- a/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.ts +++ b/src/lib/entity/detail/sz-entity-details-section/collapsible-card.component.ts @@ -50,7 +50,7 @@ export class SzEntityDetailSectionCollapsibleCardComponent implements OnInit, Af this.matchPills = this.createPillInfo(this.cardData); //console.log('MATCH PILLS! ', this.matchPills); //this.matchPills = this.createMatchPillInfo(this.cardData.records); - this.headerTitleText = !this.isEntityRecord(this.cardData) ? this.cardData.dataSource + (this.recordCount > 0 ? '(' + this.recordCount + ')' : '') : ''; + this.headerTitleText = !this.isEntityRecord(this.cardData) && this.cardData && this.cardData.dataSource ? this.cardData.dataSource + (this.recordCount > 0 ? '(' + this.recordCount + ')' : '') : ''; } ngAfterViewInit() { diff --git a/src/lib/entity/detail/sz-entity-details-section/header.component.spec.ts b/src/lib/entity/detail/sz-entity-details-section/header.component.spec.ts index b743d33a..5c7e01c8 100644 --- a/src/lib/entity/detail/sz-entity-details-section/header.component.spec.ts +++ b/src/lib/entity/detail/sz-entity-details-section/header.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityDetailSectionHeaderComponent } from './header.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityDetailSectionHeaderComponent', () => { let component: SzEntityDetailSectionHeaderComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailSectionHeaderComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailSectionHeaderComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-details-section/header.component.ts b/src/lib/entity/detail/sz-entity-details-section/header.component.ts index b1e04b81..03fc17ac 100644 --- a/src/lib/entity/detail/sz-entity-details-section/header.component.ts +++ b/src/lib/entity/detail/sz-entity-details-section/header.component.ts @@ -21,6 +21,7 @@ export class SzEntityDetailSectionHeaderComponent implements OnInit { } get countLabel(): string { + if(!this.sectionTitle) { return ''; } switch (this.sectionTitle.toLowerCase()) { case 'matched records': return 'Records'; case 'possible matches': return 'Matches'; @@ -31,16 +32,16 @@ export class SzEntityDetailSectionHeaderComponent implements OnInit { } get isMatchedRecords(): boolean { - return this.sectionTitle.toLowerCase() === 'matched records'; + return this.sectionTitle && this.sectionTitle.toLowerCase() === 'matched records'; } get isPossibleMatches(): boolean { - return this.sectionTitle.toLowerCase() === 'possible matches'; + return this.sectionTitle && this.sectionTitle.toLowerCase() === 'possible matches'; } get isPossibleRelationships(): boolean { - return this.sectionTitle.toLowerCase() === 'possible relationships'; + return this.sectionTitle && this.sectionTitle.toLowerCase() === 'possible relationships'; } get isDisclosedRelationships(): boolean { - return this.sectionTitle.toLowerCase() === 'disclosed relationships'; + return this.sectionTitle && this.sectionTitle.toLowerCase() === 'disclosed relationships'; } } diff --git a/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.spec.ts b/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.spec.ts index c7a0023b..e8796ce4 100644 --- a/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.spec.ts +++ b/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityDetailsSectionComponent } from './sz-entity-details-section.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityDetailsSectionComponent', () => { let component: SzEntityDetailsSectionComponent; @@ -8,7 +9,7 @@ describe('SzEntityDetailsSectionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityDetailsSectionComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.ts b/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.ts index 2fa62a78..b72683eb 100644 --- a/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.ts +++ b/src/lib/entity/detail/sz-entity-details-section/sz-entity-details-section.component.ts @@ -119,6 +119,7 @@ export class SzEntityDetailsSectionComponent implements OnInit { get sectionIcon(): string { let _className = 'senzing-relationships'; + if(!this.sectionTitle){ return _className; } switch(this.sectionTitle.toLowerCase()) { case 'matched records': _className = 'senzing-matches'; diff --git a/src/lib/entity/sz-entity-match-pill/sz-entity-match-pill.component.spec.ts b/src/lib/entity/sz-entity-match-pill/sz-entity-match-pill.component.spec.ts index d9fe55a4..f169a773 100644 --- a/src/lib/entity/sz-entity-match-pill/sz-entity-match-pill.component.spec.ts +++ b/src/lib/entity/sz-entity-match-pill/sz-entity-match-pill.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityMatchPillComponent } from './sz-entity-match-pill.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityMatchPillComponent', () => { let component: SzEntityMatchPillComponent; @@ -8,7 +9,7 @@ describe('SzEntityMatchPillComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityMatchPillComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/sz-entity-record-card/sz-entity-record-card-content/sz-entity-record-card-content.component.spec.ts b/src/lib/entity/sz-entity-record-card/sz-entity-record-card-content/sz-entity-record-card-content.component.spec.ts index 280e1ad0..986aa944 100644 --- a/src/lib/entity/sz-entity-record-card/sz-entity-record-card-content/sz-entity-record-card-content.component.spec.ts +++ b/src/lib/entity/sz-entity-record-card/sz-entity-record-card-content/sz-entity-record-card-content.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityRecordCardContentComponent } from './sz-entity-record-card-content.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityRecordCardContentComponent', () => { let component: SzEntityRecordCardContentComponent; @@ -8,7 +9,7 @@ describe('SzEntityRecordCardContentComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityRecordCardContentComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/sz-entity-record-card/sz-entity-record-card-header/sz-entity-record-card-header.component.spec.ts b/src/lib/entity/sz-entity-record-card/sz-entity-record-card-header/sz-entity-record-card-header.component.spec.ts index 4a33b134..12bd9d3c 100644 --- a/src/lib/entity/sz-entity-record-card/sz-entity-record-card-header/sz-entity-record-card-header.component.spec.ts +++ b/src/lib/entity/sz-entity-record-card/sz-entity-record-card-header/sz-entity-record-card-header.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityRecordCardHeaderComponent } from './sz-entity-record-card-header.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityRecordCardHeaderComponent', () => { let component: SzEntityRecordCardHeaderComponent; @@ -8,7 +9,7 @@ describe('SzEntityRecordCardHeaderComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityRecordCardHeaderComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/entity/sz-entity-record-card/sz-entity-record-card.component.spec.ts b/src/lib/entity/sz-entity-record-card/sz-entity-record-card.component.spec.ts index ca4f01ee..cd292fce 100644 --- a/src/lib/entity/sz-entity-record-card/sz-entity-record-card.component.spec.ts +++ b/src/lib/entity/sz-entity-record-card/sz-entity-record-card.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzEntityRecordCardComponent } from './sz-entity-record-card.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzEntityRecordCardComponent', () => { let component: SzEntityRecordCardComponent; @@ -8,7 +9,7 @@ describe('SzEntityRecordCardComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzEntityRecordCardComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/test.ts b/src/test.ts index 57c94a60..fd811987 100644 --- a/src/test.ts +++ b/src/test.ts @@ -32,5 +32,5 @@ const context5 = require.context('./lib/sz-powered-by', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context); context2.keys().map(context2); -//context3.keys().map(context3); +context3.keys().map(context3); context5.keys().map(context5); From 71f6d0fe98a17581e49ba93467550718f985bb12 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 10:26:40 -0700 Subject: [PATCH 7/9] #49 basic jasmine tests pass --- ...lationship-network-input.component.spec.ts | 3 ++- ...ationship-network-lookup.component.spec.ts | 3 ++- ...z-relationship-network-lookup.component.ts | 18 ++++++++----- ...ationship-network-upload.component.spec.ts | 3 ++- .../sz-relationship-network.component.spec.ts | 3 ++- .../sz-relationship-network.component.ts | 26 ++++++++++++------- .../sz-relationship-path.component.spec.ts | 3 ++- src/test.ts | 17 +----------- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/lib/graph/sz-relationship-network-input/sz-relationship-network-input.component.spec.ts b/src/lib/graph/sz-relationship-network-input/sz-relationship-network-input.component.spec.ts index fc9dd89a..243cb98d 100644 --- a/src/lib/graph/sz-relationship-network-input/sz-relationship-network-input.component.spec.ts +++ b/src/lib/graph/sz-relationship-network-input/sz-relationship-network-input.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzRelationshipNetworkInputComponent } from './sz-relationship-network-input.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzRelationshipNetworkInputComponent', () => { let component: SzRelationshipNetworkInputComponent; @@ -8,7 +9,7 @@ describe('SzRelationshipNetworkInputComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzRelationshipNetworkInputComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.spec.ts b/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.spec.ts index 119d5d83..5fec83bf 100644 --- a/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.spec.ts +++ b/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzRelationshipNetworkLookupComponent } from './sz-relationship-network-lookup.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzRelationshipNetworkLookupComponent', () => { let component: SzRelationshipNetworkLookupComponent; @@ -8,7 +9,7 @@ describe('SzRelationshipNetworkLookupComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzRelationshipNetworkLookupComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.ts b/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.ts index de0d4d19..d666316e 100644 --- a/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.ts +++ b/src/lib/graph/sz-relationship-network-lookup/sz-relationship-network-lookup.component.ts @@ -43,13 +43,17 @@ export class SzRelationshipNetworkLookupComponent implements OnInit { } broadcastInputs() { - return this.graphService.findNetworkByEntityID( - this._entityIds, - this._maxDegrees, - this._buildOut, - this._maxEntities, - SzRelationshipNetworkLookupComponent.WITH_RAW ) - .subscribe(this.emitResult.bind(this)); + if(this._entityIds){ + return this.graphService.findNetworkByEntityID( + this._entityIds, + this._maxDegrees, + this._buildOut, + this._maxEntities, + SzRelationshipNetworkLookupComponent.WITH_RAW ) + .subscribe(this.emitResult.bind(this)); + } else { + return false; + } } private emitResult(result) { diff --git a/src/lib/graph/sz-relationship-network-upload/sz-relationship-network-upload.component.spec.ts b/src/lib/graph/sz-relationship-network-upload/sz-relationship-network-upload.component.spec.ts index 598437e1..ab9a0f2c 100644 --- a/src/lib/graph/sz-relationship-network-upload/sz-relationship-network-upload.component.spec.ts +++ b/src/lib/graph/sz-relationship-network-upload/sz-relationship-network-upload.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzRelationshipNetworkUploadComponent } from './sz-relationship-network-upload.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzRelationshipNetworkUploadComponent', () => { let component: SzRelationshipNetworkUploadComponent; @@ -8,7 +9,7 @@ describe('SzRelationshipNetworkUploadComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzRelationshipNetworkUploadComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/graph/sz-relationship-network/sz-relationship-network.component.spec.ts b/src/lib/graph/sz-relationship-network/sz-relationship-network.component.spec.ts index 580eee4b..69ec7651 100644 --- a/src/lib/graph/sz-relationship-network/sz-relationship-network.component.spec.ts +++ b/src/lib/graph/sz-relationship-network/sz-relationship-network.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzRelationshipNetworkComponent } from './sz-relationship-network.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzRelationshipNetworkComponent', () => { let component: SzRelationshipNetworkComponent; @@ -8,7 +9,7 @@ describe('SzRelationshipNetworkComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzRelationshipNetworkComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/lib/graph/sz-relationship-network/sz-relationship-network.component.ts b/src/lib/graph/sz-relationship-network/sz-relationship-network.component.ts index 70b18164..39fcd2e8 100644 --- a/src/lib/graph/sz-relationship-network/sz-relationship-network.component.ts +++ b/src/lib/graph/sz-relationship-network/sz-relationship-network.component.ts @@ -191,22 +191,28 @@ export class SzRelationshipNetworkComponent implements OnInit, AfterViewInit { /** make network request and populate svg */ ngAfterViewInit() { - this.getNetwork().pipe( - map(this.asGraph.bind(this)), - tap( (gdata: Graph) => { console.log('SzRelationshipNetworkGraph: g1 = ', gdata); }) - ).subscribe( this.addSvg.bind(this) ); + if(this._entityIds){ + this.getNetwork().pipe( + map(this.asGraph.bind(this)), + tap( (gdata: Graph) => { console.log('SzRelationshipNetworkGraph: g1 = ', gdata); }) + ).subscribe( this.addSvg.bind(this) ); + } } /** * make graph network request using input parameters */ private getNetwork() { - return this.graphService.findNetworkByEntityID( - this._entityIds, - this._maxDegrees, - this._buildOut, - this._maxEntities, - SzRelationshipNetworkComponent.WITH_RAW ); + if(this._entityIds){ + return this.graphService.findNetworkByEntityID( + this._entityIds, + this._maxDegrees, + this._buildOut, + this._maxEntities, + SzRelationshipNetworkComponent.WITH_RAW ); + } else { + throw new Error('entity ids are required to make "findNetworkByEntityID" call.'); + } } /** render svg elements from graph data */ diff --git a/src/lib/graph/sz-relationship-path/sz-relationship-path.component.spec.ts b/src/lib/graph/sz-relationship-path/sz-relationship-path.component.spec.ts index 535d7852..321ac5ad 100644 --- a/src/lib/graph/sz-relationship-path/sz-relationship-path.component.spec.ts +++ b/src/lib/graph/sz-relationship-path/sz-relationship-path.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SzRelationshipPathComponent } from './sz-relationship-path.component'; +import { SenzingSdkModule } from 'src/lib/sdk.module'; describe('SzRelationshipPathComponent', () => { let component: SzRelationshipPathComponent; @@ -8,7 +9,7 @@ describe('SzRelationshipPathComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SzRelationshipPathComponent ] + imports: [SenzingSdkModule.forRoot()] }) .compileComponents(); })); diff --git a/src/test.ts b/src/test.ts index fd811987..d647bdde 100644 --- a/src/test.ts +++ b/src/test.ts @@ -17,20 +17,5 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting() ); // Then we find all the tests. -//const context = require.context('./', true, /\.spec\.ts$/); - -// config -const context = require.context('./lib/configuration', true, /\.spec\.ts$/); -// search -const context2 = require.context('./lib/search', true, /\.spec\.ts$/); -// entity -const context3 = require.context('./lib/entity', true, /\.spec\.ts$/); - -// powered by -const context5 = require.context('./lib/sz-powered-by', true, /\.spec\.ts$/); - -// And load the modules. +const context = require.context('./', true, /\.spec\.ts$/); context.keys().map(context); -context2.keys().map(context2); -context3.keys().map(context3); -context5.keys().map(context5); From 48100e55b5d9224662af8797587945f8c062cf86 Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 12:11:10 -0700 Subject: [PATCH 8/9] #49 travis.ci integration --- .travis.yml | 0 package.json | 1 + 2 files changed, 1 insertion(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e69de29b diff --git a/package.json b/package.json index 73b043bb..2b68eac7 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "publish": "cd ./dist/@senzing/sdk-components-ng/ && npm publish --access restricted", "watch": "rm -fR dist/@senzing/sdk-components-ng && concurrently --kill-others \"wait-on file:dist/@senzing/sdk-components-ng/public_api.d.ts && ng serve\" \"ng build @senzing/sdk-components-ng --watch\"", "test": "ng test", + "test:headless": "ng test --watch=false --browsers=ChromeHeadless", "start:server": "java -jar \"../senzing-api-server/target/senzing-api-server-1.6.0.jar\" -iniFile \"%LOCALAPPDATA%\\Senzing\\Workbench\\project_1\\g2.ini\" -allowedOrigins '*'", "start:rest": "npm run start:server", "server": "npm run start:server", From 3e2357155ddc8e53510064a5125b979b9dde552c Mon Sep 17 00:00:00 2001 From: Ara Winters Date: Mon, 10 Jun 2019 18:22:30 -0700 Subject: [PATCH 9/9] travis.yml config --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.travis.yml b/.travis.yml index e69de29b..162f7cb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: node_js +node_js: + - "9" +dist: trusty +sudo: required +branches: + only: + - master +before_script: + - npm install -g @angular/cli +script: +- npm run test:headless +- npm run build:docs +- npm run build