mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-12-04 19:45:12 +00:00
Adjusting some frontend tests
This commit is contained in:
parent
b1db97af87
commit
4a7ef6d637
|
@ -14,7 +14,10 @@ module.exports = function (config) {
|
||||||
require('@angular-devkit/build-angular/plugins/karma')
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
],
|
],
|
||||||
client: {
|
client: {
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||||
|
jasmine: {
|
||||||
|
random: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
coverageIstanbulReporter: {
|
coverageIstanbulReporter: {
|
||||||
dir: require('path').join(__dirname, './coverage/Betterzon'),
|
dir: require('path').join(__dirname, './coverage/Betterzon'),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {TestBed} from '@angular/core/testing';
|
import {TestBed} from '@angular/core/testing';
|
||||||
import {AppComponent} from './app.component';
|
import {AppComponent} from './app.component';
|
||||||
import {RouterTestingModule} from "@angular/router/testing";
|
import {RouterTestingModule} from '@angular/router/testing';
|
||||||
import {NgcCookieConsentConfig, NgcCookieConsentModule} from "ngx-cookieconsent";
|
import {NgcCookieConsentConfig, NgcCookieConsentModule} from 'ngx-cookieconsent';
|
||||||
import {FormsModule} from "@angular/forms";
|
import {FormsModule} from '@angular/forms';
|
||||||
|
|
||||||
// For cookie consent module testing
|
// For cookie consent module testing
|
||||||
const cookieConfig: NgcCookieConsentConfig = {
|
const cookieConfig: NgcCookieConsentConfig = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||||
import {NgcCookieConsentService, NgcInitializeEvent, NgcNoCookieLawEvent, NgcStatusChangeEvent} from 'ngx-cookieconsent';
|
import {NgcCookieConsentService, NgcInitializeEvent, NgcNoCookieLawEvent, NgcStatusChangeEvent} from 'ngx-cookieconsent';
|
||||||
import {Subscription} from 'rxjs';
|
import {Subscription} from 'rxjs';
|
||||||
import {ApiService} from "./services/api.service";
|
import {ApiService} from './services/api.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -26,8 +26,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
username?: string;
|
username?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private ccService: NgcCookieConsentService,
|
private ccService: NgcCookieConsentService
|
||||||
private api: ApiService
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import { CopyrightComponent } from './components/copyright/copyright.component';
|
||||||
import { GreetingInfoSliderComponent } from './components/greeting-info-slider/greeting-info-slider.component';
|
import { GreetingInfoSliderComponent } from './components/greeting-info-slider/greeting-info-slider.component';
|
||||||
import { KundenComponent } from './components/kunden/kunden.component';
|
import { KundenComponent } from './components/kunden/kunden.component';
|
||||||
import { AboutUsComponent } from './components/about-us/about-us.component';
|
import { AboutUsComponent } from './components/about-us/about-us.component';
|
||||||
import { ProfileComponent } from './components/profile/profile.component';
|
import { ProfileComponent } from './pages/profile/profile.component';
|
||||||
import { ProfilePageComponent } from './pages/profile-page/profile-page.component';
|
import { ProfilePageComponent } from './pages/profile-page/profile-page.component';
|
||||||
|
|
||||||
// For cookie popup
|
// For cookie popup
|
||||||
|
|
|
@ -9,10 +9,10 @@ import {ProductSearchPageComponent} from './pages/product-search-page/product-se
|
||||||
import {PageNotFoundPageComponent} from './pages/page-not-found-page/page-not-found-page.component';
|
import {PageNotFoundPageComponent} from './pages/page-not-found-page/page-not-found-page.component';
|
||||||
import {ImprintComponent} from './pages/imprint/imprint.component';
|
import {ImprintComponent} from './pages/imprint/imprint.component';
|
||||||
import {PrivacyComponent} from './pages/privacy/privacy.component';
|
import {PrivacyComponent} from './pages/privacy/privacy.component';
|
||||||
import {SigninComponent} from "./components/auth/signin/signin.component";
|
import {SigninComponent} from './components/auth/signin/signin.component';
|
||||||
import {RegistrationComponent} from "./components/auth/registration/registration.component";
|
import {RegistrationComponent} from './components/auth/registration/registration.component';
|
||||||
import {ProfileComponent} from "./components/profile/profile.component";
|
import {ProfileComponent} from './pages/profile/profile.component';
|
||||||
import {ProfilePageComponent} from "./pages/profile-page/profile-page.component";
|
import {ProfilePageComponent} from './pages/profile-page/profile-page.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{path: '', component: LandingpageComponent, pathMatch: 'full'},
|
{path: '', component: LandingpageComponent, pathMatch: 'full'},
|
||||||
|
@ -22,8 +22,8 @@ const routes: Routes = [
|
||||||
{path: 'datenschutz', component: PrivacyComponent},
|
{path: 'datenschutz', component: PrivacyComponent},
|
||||||
{path: 'signin', component: SigninComponent},
|
{path: 'signin', component: SigninComponent},
|
||||||
{path: 'registration', component: RegistrationComponent},
|
{path: 'registration', component: RegistrationComponent},
|
||||||
{path: "product-detail", component: ProductDetailPageComponent},
|
{path: 'product-detail', component: ProductDetailPageComponent},
|
||||||
{path: "profile", component: ProfilePageComponent},
|
{path: 'profile', component: ProfilePageComponent},
|
||||||
{path: '**', component: PageNotFoundPageComponent}
|
{path: '**', component: PageNotFoundPageComponent}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,33 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
import { RegistrationComponent } from './registration.component';
|
import {RegistrationComponent} from './registration.component';
|
||||||
|
import {AbstractMockObservableService} from '../../../mocks/mock.service';
|
||||||
|
import {ApiService} from '../../../services/api.service';
|
||||||
|
import {FormBuilder, FormControl, Validators} from '@angular/forms';
|
||||||
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
|
class MockApiService extends AbstractMockObservableService {
|
||||||
|
registerUser(username: string, password: string, email: string): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
describe('RegistrationComponent', () => {
|
describe('RegistrationComponent', () => {
|
||||||
let component: RegistrationComponent;
|
let component: RegistrationComponent;
|
||||||
let fixture: ComponentFixture<RegistrationComponent>;
|
let fixture: ComponentFixture<RegistrationComponent>;
|
||||||
|
let mockService;
|
||||||
|
let formBuilder: FormBuilder;
|
||||||
|
const router = {
|
||||||
|
navigate: jasmine.createSpy('navigate'),
|
||||||
|
routerState: jasmine.createSpy('routerState')
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mockService = new MockApiService();
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ RegistrationComponent ]
|
declarations: [RegistrationComponent],
|
||||||
|
providers: [{provide: ApiService, useValue: mockService}, {provide: Router, useValue: router}, FormBuilder]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
@ -16,6 +35,16 @@ describe('RegistrationComponent', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(RegistrationComponent);
|
fixture = TestBed.createComponent(RegistrationComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
formBuilder = TestBed.get(FormBuilder);
|
||||||
|
component.form = formBuilder.group({
|
||||||
|
recipientTypes: new FormControl(
|
||||||
|
{
|
||||||
|
value: ['mock'],
|
||||||
|
disabled: true
|
||||||
|
},
|
||||||
|
Validators.required
|
||||||
|
)
|
||||||
|
});
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,33 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
import { SigninComponent } from './signin.component';
|
import {SigninComponent} from './signin.component';
|
||||||
|
import {AbstractMockObservableService} from '../../../mocks/mock.service';
|
||||||
|
import {ApiService} from '../../../services/api.service';
|
||||||
|
import {FormBuilder, FormControl, Validators} from '@angular/forms';
|
||||||
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
|
class MockApiService extends AbstractMockObservableService {
|
||||||
|
loginUser(username: string, password: string): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
describe('SigninComponent', () => {
|
describe('SigninComponent', () => {
|
||||||
let component: SigninComponent;
|
let component: SigninComponent;
|
||||||
let fixture: ComponentFixture<SigninComponent>;
|
let fixture: ComponentFixture<SigninComponent>;
|
||||||
|
let mockService;
|
||||||
|
let formBuilder: FormBuilder;
|
||||||
|
const router = {
|
||||||
|
navigate: jasmine.createSpy('navigate'),
|
||||||
|
routerState: jasmine.createSpy('routerState')
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mockService = new MockApiService();
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ SigninComponent ]
|
declarations: [SigninComponent],
|
||||||
|
providers: [{provide: ApiService, useValue: mockService}, {provide: Router, useValue: router}, FormBuilder]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
@ -16,6 +35,16 @@ describe('SigninComponent', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(SigninComponent);
|
fixture = TestBed.createComponent(SigninComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
formBuilder = TestBed.get(FormBuilder);
|
||||||
|
component.loginForm = formBuilder.group({
|
||||||
|
recipientTypes: new FormControl(
|
||||||
|
{
|
||||||
|
value: ['mock'],
|
||||||
|
disabled: true
|
||||||
|
},
|
||||||
|
Validators.required
|
||||||
|
)
|
||||||
|
});
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#imprintSection {
|
||||||
|
right: 1em;
|
||||||
|
bottom: 1em;
|
||||||
|
width: 100%;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 1em;
|
||||||
|
grid-area: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#imprintSection a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#copyright {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
'left center right';
|
||||||
|
grid-template-columns: 30% 40% 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#copyright-text {
|
||||||
|
grid-area: center;
|
||||||
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
<div class="copyright py-4 text-center text-white">
|
<div class="copyright py-4 text-center text-white" id="copyright">
|
||||||
<div class="container"><small>Copyright © Betterzon 2021</small></div>
|
<div class="container" id="copyright-text"><small>Copyright © Betterzon 2021</small></div>
|
||||||
|
<div id="imprintSection">
|
||||||
|
<a href="/impressum" >Imprint</a><br>
|
||||||
|
<a href="/datenschutz">Privacy Policy</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,47 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
import { HotDealsWidgetComponent } from './hot-deals-widget.component';
|
import {HotDealsWidgetComponent} from './hot-deals-widget.component';
|
||||||
|
import {AbstractMockObservableService} from '../../mocks/mock.service';
|
||||||
|
import {ApiService} from '../../services/api.service';
|
||||||
|
import {ActivatedRoute, convertToParamMap, Router} from '@angular/router';
|
||||||
|
import {Observable, of} from 'rxjs';
|
||||||
|
|
||||||
|
class MockApiService extends AbstractMockObservableService {
|
||||||
|
getBestDeals(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProductsByIds(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ActivatedRouteMock {
|
||||||
|
public paramMap = of(convertToParamMap({
|
||||||
|
testId: 'abc123',
|
||||||
|
anotherId: 'd31e8b48-7309-4c83-9884-4142efdf7271',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
describe('HotDealsWidgetComponent', () => {
|
describe('HotDealsWidgetComponent', () => {
|
||||||
let component: HotDealsWidgetComponent;
|
let component: HotDealsWidgetComponent;
|
||||||
let fixture: ComponentFixture<HotDealsWidgetComponent>;
|
let fixture: ComponentFixture<HotDealsWidgetComponent>;
|
||||||
|
let mockService;
|
||||||
|
const router = {
|
||||||
|
navigate: jasmine.createSpy('navigate'),
|
||||||
|
routerState: jasmine.createSpy('routerState')
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mockService = new MockApiService();
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ HotDealsWidgetComponent ]
|
declarations: [HotDealsWidgetComponent],
|
||||||
|
providers: [{provide: ApiService, useValue: mockService}, {provide: Router, useValue: router}, {
|
||||||
|
provide: ActivatedRoute,
|
||||||
|
useValue: ActivatedRouteMock
|
||||||
|
}]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,42 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
import { KundenComponent } from './kunden.component';
|
import {KundenComponent} from './kunden.component';
|
||||||
|
import {AbstractMockObservableService} from '../../mocks/mock.service';
|
||||||
|
import {ApiService} from '../../services/api.service';
|
||||||
|
import {ActivatedRoute, convertToParamMap, Router} from '@angular/router';
|
||||||
|
import {of} from 'rxjs';
|
||||||
|
|
||||||
|
class MockApiService extends AbstractMockObservableService {
|
||||||
|
getProducts(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ActivatedRouteMock {
|
||||||
|
public paramMap = of(convertToParamMap({
|
||||||
|
testId: 'abc123',
|
||||||
|
anotherId: 'd31e8b48-7309-4c83-9884-4142efdf7271',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
describe('KundenComponent', () => {
|
describe('KundenComponent', () => {
|
||||||
let component: KundenComponent;
|
let component: KundenComponent;
|
||||||
let fixture: ComponentFixture<KundenComponent>;
|
let fixture: ComponentFixture<KundenComponent>;
|
||||||
|
let mockService;
|
||||||
|
const router = {
|
||||||
|
navigate: jasmine.createSpy('navigate'),
|
||||||
|
routerState: jasmine.createSpy('routerState')
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mockService = new MockApiService();
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ KundenComponent ]
|
declarations: [KundenComponent],
|
||||||
|
providers: [{provide: ApiService, useValue: mockService}, {provide: Router, useValue: router}, {
|
||||||
|
provide: ActivatedRoute,
|
||||||
|
useValue: ActivatedRouteMock
|
||||||
|
}]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
|
@ -58,6 +58,11 @@ class MockApiService extends AbstractMockObservableService {
|
||||||
this.content = [vendor];
|
this.content = [vendor];
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSessionInfoFromLocalStorage(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('ProductDetailsComponent', () => {
|
describe('ProductDetailsComponent', () => {
|
||||||
|
|
|
@ -70,7 +70,8 @@ describe('ProductListComponent', () => {
|
||||||
last_modified: new Date(),
|
last_modified: new Date(),
|
||||||
manufacturer_id: 1,
|
manufacturer_id: 1,
|
||||||
selling_rank: '1',
|
selling_rank: '1',
|
||||||
category_id: 1
|
category_id: 1,
|
||||||
|
price: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
component.clickedProduct(product);
|
component.clickedProduct(product);
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ProfileComponent } from './profile.component';
|
|
||||||
|
|
||||||
describe('ProfileComponent', () => {
|
|
||||||
let component: ProfileComponent;
|
|
||||||
let fixture: ComponentFixture<ProfileComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ ProfileComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(ProfileComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,14 +1,37 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
import { TopBarComponent } from './top-bar.component';
|
import {TopBarComponent} from './top-bar.component';
|
||||||
|
import {FormBuilder} from '@angular/forms';
|
||||||
|
import {ApiService} from '../../services/api.service';
|
||||||
|
import {Router} from '@angular/router';
|
||||||
|
import {AbstractMockObservableService} from '../../mocks/mock.service';
|
||||||
|
|
||||||
|
class MockApiService extends AbstractMockObservableService {
|
||||||
|
getUserInfo(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSessionInfoFromLocalStorage(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
describe('TopBarComponent', () => {
|
describe('TopBarComponent', () => {
|
||||||
let component: TopBarComponent;
|
let component: TopBarComponent;
|
||||||
let fixture: ComponentFixture<TopBarComponent>;
|
let fixture: ComponentFixture<TopBarComponent>;
|
||||||
|
let mockService;
|
||||||
|
const router = {
|
||||||
|
navigate: jasmine.createSpy('navigate'),
|
||||||
|
routerState: jasmine.createSpy('routerState')
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
mockService = new MockApiService();
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ TopBarComponent ]
|
declarations: [TopBarComponent],
|
||||||
|
providers: [{provide: ApiService, useValue: mockService}, {provide: Router, useValue: router}]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<app-header [showSearch]="true"></app-header>
|
<app-top-bar></app-top-bar>
|
||||||
<div id="imprint">
|
<div id="imprint" class="container masthead">
|
||||||
<h1>Impressum</h1>
|
<h1>Impressum</h1>
|
||||||
|
|
||||||
<h2>Angaben gemäß § 5 TMG</h2>
|
<h2>Angaben gemäß § 5 TMG</h2>
|
||||||
|
@ -56,4 +56,5 @@
|
||||||
derartige Inhalte umgehend entfernen.
|
derartige Inhalte umgehend entfernen.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<app-footer></app-footer>
|
<app-bottom-bar></app-bottom-bar>
|
||||||
|
<app-copyright></app-copyright>
|
||||||
|
|
|
@ -12,8 +12,7 @@ export class LandingpageComponent implements OnInit {
|
||||||
isLoggedIn = false;
|
isLoggedIn = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router
|
||||||
private api: ApiService
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<app-header [showSearch]="true"></app-header>
|
<app-top-bar></app-top-bar>
|
||||||
<div id="privacy">
|
<div id="privacy" class="container masthead">
|
||||||
<h1>Datenschutz­erklärung</h1>
|
<h1>Datenschutz­erklärung</h1>
|
||||||
<h2>1. Datenschutz auf einen Blick</h2>
|
<h2>1. Datenschutz auf einen Blick</h2>
|
||||||
<h3>Allgemeine Hinweise</h3>
|
<h3>Allgemeine Hinweise</h3>
|
||||||
|
@ -405,4 +405,5 @@
|
||||||
von Font Awesome unter: <a href="https://fontawesome.com/privacy" target="_blank" rel="noopener noreferrer">https://fontawesome.com/privacy</a>.
|
von Font Awesome unter: <a href="https://fontawesome.com/privacy" target="_blank" rel="noopener noreferrer">https://fontawesome.com/privacy</a>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<app-footer></app-footer>
|
<app-bottom-bar></app-bottom-bar>
|
||||||
|
<app-copyright></app-copyright>
|
||||||
|
|
47
Frontend/src/app/pages/profile/profile.component.spec.ts
Normal file
47
Frontend/src/app/pages/profile/profile.component.spec.ts
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
|
||||||
|
import {ProfileComponent} from './profile.component';
|
||||||
|
import {AbstractMockObservableService} from '../../mocks/mock.service';
|
||||||
|
import {ApiService} from '../../services/api.service';
|
||||||
|
|
||||||
|
class MockApiService extends AbstractMockObservableService {
|
||||||
|
getUserInfo(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPriceAlarms(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProductsByIds(): any {
|
||||||
|
this.content = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('ProfileComponent', () => {
|
||||||
|
let component: ProfileComponent;
|
||||||
|
let fixture: ComponentFixture<ProfileComponent>;
|
||||||
|
let mockService;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
mockService = new MockApiService();
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ProfileComponent],
|
||||||
|
providers: [{provide: ApiService, useValue: mockService}]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ProfileComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -106,7 +106,7 @@ export class ApiService {
|
||||||
let asin = '';
|
let asin = '';
|
||||||
|
|
||||||
// Check if the parameter is a link or an asin
|
// Check if the parameter is a link or an asin
|
||||||
const linkRegex: RegExp = /^http[s]{0,1}:\/\/.*\/dp\/(.[^\/]*)\/{0,1}.*$/;
|
const linkRegex: RegExp = /^http[s]?:\/\/.*\/dp\/(.[^\/]*)\/?.*$/;
|
||||||
const matches = linkRegex.exec(asinOrLink);
|
const matches = linkRegex.exec(asinOrLink);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
// param is a link, extract asin
|
// param is a link, extract asin
|
||||||
|
|
Loading…
Reference in New Issue
Block a user