Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(error-handler): move error-handler and all its dependencies into library #1126

Merged
merged 7 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import { DatadogRumService } from '../../services/datadog-rum.service';
import { Session, SessionService } from '@dasch-swiss/vre/shared/app-session';
import { LoginFormComponent } from './login-form.component';
import { MockProvider } from 'ng-mocks';
import { AppLoggingService } from '@dasch-swiss/vre/shared/app-logging';

/**
* test host component to simulate login-form component.
Expand All @@ -41,7 +43,7 @@

loggedIn: boolean;

ngOnInit() {}

Check warning on line 46 in apps/dsp-app/src/app/main/action/login-form/login-form.component.spec.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Lifecycle methods should not be empty

// if response is true, the login was successful
// assign loggedIn to the response
Expand Down Expand Up @@ -88,6 +90,7 @@
],
providers: [
AppConfigService,
MockProvider(AppLoggingService),
DatadogRumService,
SessionService,
{
Expand Down Expand Up @@ -119,7 +122,7 @@
}
);
spyOn(sessionStorage, 'setItem').and.callFake(
(key: string, value: string): string => (store[key] = <any>value)

Check warning on line 125 in apps/dsp-app/src/app/main/action/login-form/login-form.component.spec.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Unexpected any. Specify a different type
);
spyOn(sessionStorage, 'clear').and.callFake(() => {
store = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
UserResponse,
} from '@dasch-swiss/dsp-js';
import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config';
import { ErrorHandlerService } from '../../services/error-handler.service';
import { AppErrorHandler } from '@dasch-swiss/vre/shared/app-error-handler';
import { AuthenticationService } from '../../services/authentication.service';
import {
ComponentCommunicationEventService,
Expand Down Expand Up @@ -123,7 +123,7 @@ export class LoginFormComponent implements OnInit, AfterViewInit {
private _auth: AuthenticationService,
private _componentCommsService: ComponentCommunicationEventService,
private _datadogRumService: DatadogRumService,
private _errorHandler: ErrorHandlerService,
private _errorHandler: AppErrorHandler,
private _fb: UntypedFormBuilder,
private _session: SessionService,
private _route: ActivatedRoute,
Expand Down
2 changes: 1 addition & 1 deletion apps/dsp-app/src/app/main/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
DspApiConnectionToken,
DspConfig,
} from '@dasch-swiss/vre/shared/app-config';
import { NotificationService } from '../services/notification.service';
import { NotificationService } from '@dasch-swiss/vre/shared/app-notification';
import { SessionService } from '@dasch-swiss/vre/shared/app-session';

@Component({
Expand Down
3 changes: 3 additions & 0 deletions apps/dsp-app/src/app/main/help/help.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { StatusComponent } from '../status/status.component';
import { FooterComponent } from '../footer/footer.component';
import { GridComponent } from '../grid/grid.component';
import { HelpComponent } from './help.component';
import { MockProvider } from 'ng-mocks';
import { AppLoggingService } from '@dasch-swiss/vre/shared/app-logging';

describe('HelpComponent', () => {
let component: HelpComponent;
Expand Down Expand Up @@ -49,6 +51,7 @@ describe('HelpComponent', () => {
],
providers: [
AppConfigService,
MockProvider(AppLoggingService),
{
provide: DspApiConfigToken,
useValue: TestConfig.ApiConfig,
Expand Down
4 changes: 2 additions & 2 deletions apps/dsp-app/src/app/main/help/help.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
DspApiConnectionToken,
DspConfig,
} from '@dasch-swiss/vre/shared/app-config';
import { ErrorHandlerService } from '../services/error-handler.service';
import { AppErrorHandler } from '@dasch-swiss/vre/shared/app-error-handler';
import { GridItem } from '../grid/grid.component';
import { environment } from '@dsp-app/src/environments/environment';

Expand Down Expand Up @@ -100,7 +100,7 @@ export class HelpComponent implements OnInit {
@Inject(DspApiConnectionToken)
private _dspApiConnection: KnoraApiConnection,
private _appConfigService: AppConfigService,
private _errorHandler: ErrorHandlerService
private _errorHandler: AppErrorHandler
) {}

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
import { AuthenticationService } from './authentication.service';
import { DatadogRumService } from './datadog-rum.service';
import { SessionService } from '@dasch-swiss/vre/shared/app-session';
import { MockProvider } from 'ng-mocks';
import { AppLoggingService } from '@dasch-swiss/vre/shared/app-logging';

describe('AuthenticationService', () => {
let service: AuthenticationService;
Expand All @@ -21,7 +23,10 @@ describe('AuthenticationService', () => {
},
};

const applicationStateServiceSpy = jasmine.createSpyObj('ApplicationStateService', ['destroy']);
const applicationStateServiceSpy = jasmine.createSpyObj(
'ApplicationStateService',
['destroy']
);

const datadogRumServiceSpy = jasmine.createSpyObj('datadogRumService', [
'',
Expand All @@ -33,6 +38,7 @@ describe('AuthenticationService', () => {
imports: [MatDialogModule, MatSnackBarModule],
providers: [
AppConfigService,
MockProvider(AppLoggingService),
SessionService,
{
provide: DspApiConfigToken,
Expand Down
4 changes: 2 additions & 2 deletions apps/dsp-app/src/app/main/services/authentication.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@angular/core';
import { ApiResponseError, KnoraApiConnection } from '@dasch-swiss/dsp-js';
import { ApplicationStateService } from '@dasch-swiss/vre/shared/app-state-service';
import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config';
import { ErrorHandlerService } from '../services/error-handler.service';
import { AppErrorHandler } from '@dasch-swiss/vre/shared/app-error-handler';
import { DatadogRumService } from './datadog-rum.service';
import { SessionService } from '@dasch-swiss/vre/shared/app-session';

Expand All @@ -15,7 +15,7 @@ export class AuthenticationService {
private _dspApiConnection: KnoraApiConnection,
private _applicationStateService: ApplicationStateService,
private _datadogRumService: DatadogRumService,
private _errorHandler: ErrorHandlerService,
private _errorHandler: AppErrorHandler,
private _session: SessionService
) {}

Expand Down
94 changes: 0 additions & 94 deletions apps/dsp-app/src/app/main/services/error-handler.service.spec.ts

This file was deleted.

140 changes: 0 additions & 140 deletions apps/dsp-app/src/app/main/services/error-handler.service.ts

This file was deleted.

35 changes: 0 additions & 35 deletions apps/dsp-app/src/app/main/services/notification.service.spec.ts

This file was deleted.