style: apply prettier formatting
This commit is contained in:
@@ -97,7 +97,9 @@ describe('ProductDetailComponent', () => {
|
||||
const languageService = {
|
||||
currentLang,
|
||||
selectedLang: () => currentLang(),
|
||||
setLocalizedRouteOverrides: jasmine.createSpy('setLocalizedRouteOverrides'),
|
||||
setLocalizedRouteOverrides: jasmine.createSpy(
|
||||
'setLocalizedRouteOverrides',
|
||||
),
|
||||
clearLocalizedRouteOverrides: jasmine.createSpy(
|
||||
'clearLocalizedRouteOverrides',
|
||||
),
|
||||
@@ -113,7 +115,9 @@ describe('ProductDetailComponent', () => {
|
||||
.createSpy('quantityForVariant')
|
||||
.and.returnValue(0),
|
||||
loadCart: jasmine.createSpy('loadCart').and.returnValue(of(null)),
|
||||
resolveMediaUrl: jasmine.createSpy('resolveMediaUrl').and.returnValue(null),
|
||||
resolveMediaUrl: jasmine
|
||||
.createSpy('resolveMediaUrl')
|
||||
.and.returnValue(null),
|
||||
};
|
||||
|
||||
const router = {
|
||||
@@ -126,9 +130,13 @@ describe('ProductDetailComponent', () => {
|
||||
} as unknown as Router;
|
||||
|
||||
const activatedRoute = {
|
||||
paramMap: of(convertToParamMap({ productSlug: '91823f84-bike-wall-hanger' })),
|
||||
paramMap: of(
|
||||
convertToParamMap({ productSlug: '91823f84-bike-wall-hanger' }),
|
||||
),
|
||||
snapshot: {
|
||||
paramMap: convertToParamMap({ productSlug: '91823f84-bike-wall-hanger' }),
|
||||
paramMap: convertToParamMap({
|
||||
productSlug: '91823f84-bike-wall-hanger',
|
||||
}),
|
||||
},
|
||||
} as unknown as ActivatedRoute;
|
||||
|
||||
@@ -200,7 +208,9 @@ describe('ProductDetailComponent', () => {
|
||||
it('builds a soft SSR fallback with 200 + index follow', () => {
|
||||
const { component, seoService, responseInit } = createComponent();
|
||||
|
||||
expect((component as any).shouldUseSoftSeoFallback({ status: 500 })).toBeTrue();
|
||||
expect(
|
||||
(component as any).shouldUseSoftSeoFallback({ status: 500 }),
|
||||
).toBeTrue();
|
||||
(component as any).setResponseStatus(200);
|
||||
(component as any).applySoftFallbackSeo('91823f84-bike-wall-hanger');
|
||||
|
||||
@@ -221,7 +231,9 @@ describe('ProductDetailComponent', () => {
|
||||
it('keeps hard fallback noindex for missing products', () => {
|
||||
const { component, seoService, responseInit } = createComponent();
|
||||
|
||||
expect((component as any).shouldUseSoftSeoFallback({ status: 404 })).toBeFalse();
|
||||
expect(
|
||||
(component as any).shouldUseSoftSeoFallback({ status: 404 }),
|
||||
).toBeFalse();
|
||||
(component as any).setResponseStatus(404);
|
||||
(component as any).applyHardFallbackSeo();
|
||||
|
||||
|
||||
@@ -254,9 +254,7 @@ export class ProductDetailComponent {
|
||||
}
|
||||
|
||||
const productSlug = routeParams.productSlug as string;
|
||||
return this.shopService
|
||||
.getProductByPublicPath(productSlug)
|
||||
.pipe(
|
||||
return this.shopService.getProductByPublicPath(productSlug).pipe(
|
||||
catchError((error) => {
|
||||
this.languageService.clearLocalizedRouteOverrides();
|
||||
this.product.set(null);
|
||||
@@ -904,9 +902,7 @@ export class ProductDetailComponent {
|
||||
return this.normalizeRouteParam(this.route.snapshot.paramMap.get(name));
|
||||
}
|
||||
|
||||
private normalizeRouteParam(
|
||||
value: string | null | undefined,
|
||||
): string | null {
|
||||
private normalizeRouteParam(value: string | null | undefined): string | null {
|
||||
const normalized = String(value ?? '').trim();
|
||||
return normalized || null;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ describe('ShopPageComponent', () => {
|
||||
'TranslateService',
|
||||
['instant'],
|
||||
);
|
||||
translate.instant.and.callFake((key: string, params?: { count?: number }) => {
|
||||
translate.instant.and.callFake(
|
||||
(key: string, params?: { count?: number }) => {
|
||||
const translations: Record<string, string> = {
|
||||
'SHOP.TITLE': 'Technische Lösungen',
|
||||
'SHOP.SUBTITLE': 'Fertige Produkte, die praktische Probleme lösen',
|
||||
@@ -77,7 +78,8 @@ describe('ShopPageComponent', () => {
|
||||
return `${params?.count ?? 0} Produkte in dieser Kategorie verfügbar`;
|
||||
}
|
||||
return translations[key] ?? key;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
const currentLang = signal<'it' | 'en' | 'de' | 'fr'>('de');
|
||||
const languageService = {
|
||||
@@ -100,11 +102,17 @@ describe('ShopPageComponent', () => {
|
||||
flattenCategoryTree: jasmine
|
||||
.createSpy('flattenCategoryTree')
|
||||
.and.returnValue([]),
|
||||
quantityForProduct: jasmine.createSpy('quantityForProduct').and.returnValue(0),
|
||||
quantityForProduct: jasmine
|
||||
.createSpy('quantityForProduct')
|
||||
.and.returnValue(0),
|
||||
loadCart: jasmine.createSpy('loadCart').and.returnValue(of(null)),
|
||||
clearCart: jasmine.createSpy('clearCart').and.returnValue(of(null)),
|
||||
removeCartItem: jasmine.createSpy('removeCartItem').and.returnValue(of(null)),
|
||||
updateCartItem: jasmine.createSpy('updateCartItem').and.returnValue(of(null)),
|
||||
removeCartItem: jasmine
|
||||
.createSpy('removeCartItem')
|
||||
.and.returnValue(of(null)),
|
||||
updateCartItem: jasmine
|
||||
.createSpy('updateCartItem')
|
||||
.and.returnValue(of(null)),
|
||||
};
|
||||
|
||||
const router = {
|
||||
@@ -164,7 +172,9 @@ describe('ShopPageComponent', () => {
|
||||
});
|
||||
|
||||
it('keeps noindex for categories explicitly marked as non-indexable', () => {
|
||||
const { component, seoService } = createComponent('/de/shop/compatible-with-garmin');
|
||||
const { component, seoService } = createComponent(
|
||||
'/de/shop/compatible-with-garmin',
|
||||
);
|
||||
|
||||
(component as any).applySeo(buildCategory({ indexable: false }));
|
||||
|
||||
@@ -180,7 +190,9 @@ describe('ShopPageComponent', () => {
|
||||
'/de/shop/compatible-with-garmin',
|
||||
);
|
||||
|
||||
expect((component as any).shouldUseSoftSeoFallback({ status: 500 })).toBeTrue();
|
||||
expect(
|
||||
(component as any).shouldUseSoftSeoFallback({ status: 500 }),
|
||||
).toBeTrue();
|
||||
(component as any).setResponseStatus(200);
|
||||
(component as any).applySoftFallbackSeo('compatible-with-garmin');
|
||||
|
||||
@@ -203,7 +215,9 @@ describe('ShopPageComponent', () => {
|
||||
'/de/shop/compatible-with-garmin',
|
||||
);
|
||||
|
||||
expect((component as any).shouldUseSoftSeoFallback({ status: 404 })).toBeFalse();
|
||||
expect(
|
||||
(component as any).shouldUseSoftSeoFallback({ status: 404 }),
|
||||
).toBeFalse();
|
||||
(component as any).setResponseStatus(404);
|
||||
(component as any).applyHardErrorSeo();
|
||||
|
||||
|
||||
@@ -528,9 +528,7 @@ export class ShopPageComponent {
|
||||
return this.normalizeRouteParam(this.route.snapshot.paramMap.get(name));
|
||||
}
|
||||
|
||||
private normalizeRouteParam(
|
||||
value: string | null | undefined,
|
||||
): string | null {
|
||||
private normalizeRouteParam(value: string | null | undefined): string | null {
|
||||
const normalized = String(value ?? '').trim();
|
||||
return normalized || null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user