merge-requests/3/merge
Nato Boram 2020-07-07 20:20:02 -04:00
parent c050381c49
commit 03f3975132
No known key found for this signature in database
GPG Key ID: 478E3C64BF88AFFA
7 changed files with 27 additions and 27 deletions

View File

@ -196,6 +196,7 @@
}, },
"defaultProject": "public-gateway-cacher", "defaultProject": "public-gateway-cacher",
"cli": { "cli": {
"packageManager": "yarn" "packageManager": "yarn",
"analytics": "10b848ad-8b81-4346-852f-5eff89573a85"
} }
} }

View File

@ -1,19 +1,19 @@
import { browser, logging } from 'protractor'; import { browser, logging } from 'protractor';
import { AppPage } from './app.po'; import { AppPage } from './app.po';
describe('workspace-project App', () => { describe('workspace-project App', (): void => {
let page: AppPage; let page: AppPage;
beforeEach(() => { beforeEach((): void => {
page = new AppPage(); page = new AppPage();
}); });
it('should display welcome message', () => { it('should display welcome message', (): void => {
page.navigateTo(); page.navigateTo();
expect(page.getTitleText()).toEqual('public-gateway-cacher app is running!'); expect(page.getTitleText()).toEqual('public-gateway-cacher app is running!');
}); });
afterEach(async () => { afterEach(async (): Promise<void> => {
// Assert that there are no errors emitted from the browser // Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER); const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({ expect(logs).not.toContain(jasmine.objectContaining({

View File

@ -1,9 +1,9 @@
import { TestBed, async } from '@angular/core/testing'; import { async, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
describe('AppComponent', () => { describe('AppComponent', (): void => {
beforeEach(async(() => { beforeEach(async((): void => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
RouterTestingModule RouterTestingModule
@ -14,19 +14,19 @@ describe('AppComponent', () => {
}).compileComponents(); }).compileComponents();
})); }));
it('should create the app', () => { it('should create the app', (): void => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy(); expect(app).toBeTruthy();
}); });
it(`should have as title 'public-gateway-cacher'`, () => { it(`should have as title 'public-gateway-cacher'`, (): void => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('public-gateway-cacher'); expect(app.title).toEqual('public-gateway-cacher');
}); });
it('should render title', () => { it('should render title', (): void => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement; const compiled = fixture.debugElement.nativeElement;

View File

@ -1,24 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PagesComponent } from './pages.component'; import { PagesComponent } from './pages.component';
describe('PagesComponent', () => { describe('PagesComponent', (): void => {
let component: PagesComponent; let component: PagesComponent;
let fixture: ComponentFixture<PagesComponent>; let fixture: ComponentFixture<PagesComponent>;
beforeEach(async(() => { beforeEach(async((): void => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [PagesComponent] declarations: [PagesComponent]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach((): void => {
fixture = TestBed.createComponent(PagesComponent); fixture = TestBed.createComponent(PagesComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', (): void => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
}); });

View File

@ -29,7 +29,7 @@ export class PagesComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.dataSource = new MatTableDataSource([]); this.dataSource = new MatTableDataSource([]);
this.gatewayService.list().subscribe(gateways => this.gateways = gateways); this.gatewayService.list().subscribe((gateways): void => { this.gateways = gateways; });
} }
cacheIPFS(): void { cacheIPFS(): void {
@ -53,12 +53,12 @@ export class PagesComponent implements OnInit {
this.matTable.renderRows(); this.matTable.renderRows();
console.clear(); console.clear();
this.gateways.forEach(gateway => { this.gateways.forEach((gateway): void => {
this.subscriptions.push( this.subscriptions.push(
this.gatewayService.get(gateway, type, hash).subscribe(_ => { this.gatewayService.get(gateway, type, hash).subscribe((): void => {
this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error: null }); this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error: null });
this.matTable.renderRows(); this.matTable.renderRows();
}, (error: HttpErrorResponse) => { }, (error: HttpErrorResponse): void => {
this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error }); this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error });
this.matTable.renderRows(); this.matTable.renderRows();
}) })

View File

@ -1,12 +1,11 @@
import { TestBed } from '@angular/core/testing'; import { TestBed, TestBedStatic } from '@angular/core/testing';
import { GatewayService } from './gateway.service'; import { GatewayService } from './gateway.service';
describe('GatewayService', () => { describe('GatewayService', (): void => {
beforeEach(() => TestBed.configureTestingModule({})); beforeEach((): TestBedStatic => TestBed.configureTestingModule({}));
it('should be created', () => { it('should be created', (): void => {
const service: GatewayService = TestBed.get(GatewayService); const service: GatewayService = TestBed.inject(GatewayService);
expect(service).toBeTruthy(); expect(service).toBeTruthy();
}); });
}); });

View File

@ -8,4 +8,4 @@ if (environment.production) {
} }
platformBrowserDynamic().bootstrapModule(AppModule) platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err)); .catch((err): void => console.error(err));