Skip to content

Commit

Permalink
Merge pull request #72 from SwimResults/develop
Browse files Browse the repository at this point in the history
`Patch: ` stop users from being logged out
  • Loading branch information
konrad2002 authored Apr 10, 2024
2 parents 9468259 + 13e1e68 commit cf5fd10
Show file tree
Hide file tree
Showing 17 changed files with 397 additions and 349 deletions.
38 changes: 19 additions & 19 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss",
"src/material.scss",
"src/colors.scss"
],
"scripts": [],
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss",
"src/material.scss",
"src/colors.scss"
],
"scripts": [],
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"budgets": [
{
"type": "initial",
Expand Down
62 changes: 32 additions & 30 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import {TestBed} from '@angular/core/testing';
import {AppComponent} from './app.component';
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {RouterTestingModule} from "@angular/router/testing";
import {ElementsModule} from "./shared/elements/elements.module";
import {LayoutModule} from "./shared/layout/layout.module";
import {TranslateModule} from "@ngx-translate/core";
import {OAuthModule} from "angular-oauth2-oidc";

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
imports: [
HttpClientTestingModule,
RouterTestingModule,
ElementsModule,
LayoutModule,
TranslateModule.forRoot()
]
}).compileComponents();
});
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
imports: [
HttpClientTestingModule,
RouterTestingModule,
ElementsModule,
LayoutModule,
TranslateModule.forRoot(),
OAuthModule.forRoot()
]
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'swimresults'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('swimresults');
});
it(`should have as title 'swimresults'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('swimresults');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
});
});
1 change: 1 addition & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class AppComponent implements OnDestroy {
lang = navigator.language;
}
this.translateService.use(lang);

this.menuService.viewType.subscribe(data => {
this.sidebarState = data;
})
Expand Down
14 changes: 13 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ import {TranslateHttpLoader} from "@ngx-translate/http-loader";
import {JwtInterceptor} from "./core/interceptor/jwt.interceptor";
import {MatSelectModule} from "@angular/material/select";
import { ServiceWorkerModule } from '@angular/service-worker';
import {OAuthModule, OAuthStorage} from "angular-oauth2-oidc";

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}

export function storageFactory(): OAuthStorage {
return localStorage;
}

@NgModule({
declarations: [
AppComponent
Expand All @@ -37,6 +42,12 @@ export function HttpLoaderFactory(http: HttpClient) {
},
defaultLanguage: 'en'
}),
OAuthModule.forRoot({
resourceServer: {
allowedUrls: [],
sendAccessToken: true,
}
}),
MatSelectModule,
ServiceWorkerModule.register('/assets/service-worker-v1.js', {
enabled: !isDevMode(),
Expand All @@ -49,7 +60,8 @@ export function HttpLoaderFactory(http: HttpClient) {
AppComponent
],
providers: [
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true},
{ provide: OAuthStorage, useFactory: storageFactory}
],
bootstrap: [AppComponent]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { UserProfileComponent } from './user-profile.component';
import {UserProfileComponent} from './user-profile.component';
import {AccountModule} from "../../account.module";
import {TranslateModule} from "@ngx-translate/core";
import {OAuthModule} from "angular-oauth2-oidc";

describe('UserProfileComponent', () => {
let component: UserProfileComponent;
let fixture: ComponentFixture<UserProfileComponent>;
let component: UserProfileComponent;
let fixture: ComponentFixture<UserProfileComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ UserProfileComponent ],
imports: [
AccountModule,
TranslateModule.forRoot()
]
})
.compileComponents();
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [UserProfileComponent],
imports: [
AccountModule,
TranslateModule.forRoot(),
OAuthModule.forRoot()
]
})
.compileComponents();

fixture = TestBed.createComponent(UserProfileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(UserProfileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { AthleteListViewComponent } from './athlete-list-view.component';
import {AthleteListViewComponent} from './athlete-list-view.component';
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {AthletesModule} from "../../athletes.module";
import {TranslateModule} from "@ngx-translate/core";
import {RouterTestingModule} from "@angular/router/testing";
import {OAuthModule} from "angular-oauth2-oidc";

describe('AthleteListViewComponent', () => {
let component: AthleteListViewComponent;
let fixture: ComponentFixture<AthleteListViewComponent>;
let component: AthleteListViewComponent;
let fixture: ComponentFixture<AthleteListViewComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AthleteListViewComponent ],
imports: [
HttpClientTestingModule,
AthletesModule,
TranslateModule.forRoot(),
RouterTestingModule
]
})
.compileComponents();
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AthleteListViewComponent],
imports: [
HttpClientTestingModule,
AthletesModule,
TranslateModule.forRoot(),
RouterTestingModule,
OAuthModule.forRoot()
]
})
.compileComponents();

fixture = TestBed.createComponent(AthleteListViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(AthleteListViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';

import { PageAthletesEventComponent } from './page-athletes-event.component';
import {PageAthletesEventComponent} from './page-athletes-event.component';
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {ElementsModule} from "../../../../shared/elements/elements.module";
import {RouterTestingModule} from "@angular/router/testing";
import {AthletesModule} from "../../athletes.module";
import {TranslateModule} from "@ngx-translate/core";
import {OAuthModule} from "angular-oauth2-oidc";

describe('PageAthletesEventComponent', () => {
let component: PageAthletesEventComponent;
let fixture: ComponentFixture<PageAthletesEventComponent>;
let component: PageAthletesEventComponent;
let fixture: ComponentFixture<PageAthletesEventComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageAthletesEventComponent ],
imports: [
ElementsModule,
RouterTestingModule,
HttpClientTestingModule,
AthletesModule,
TranslateModule.forRoot()
]
})
.compileComponents();
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PageAthletesEventComponent],
imports: [
ElementsModule,
RouterTestingModule,
HttpClientTestingModule,
AthletesModule,
TranslateModule.forRoot(),
OAuthModule.forRoot()

fixture = TestBed.createComponent(PageAthletesEventComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
]
})
.compileComponents();

it('should create', () => {
expect(component).toBeTruthy();
});
fixture = TestBed.createComponent(PageAthletesEventComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit cf5fd10

Please sign in to comment.