diff --git a/marketplace-service/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.html b/marketplace-service/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.html deleted file mode 100644 index e69de29b..00000000 diff --git a/marketplace-ui/src/app/core/interceptors/api.interceptor.ts b/marketplace-ui/src/app/core/interceptors/api.interceptor.ts index e59b5e72..52b9213c 100644 --- a/marketplace-ui/src/app/core/interceptors/api.interceptor.ts +++ b/marketplace-ui/src/app/core/interceptors/api.interceptor.ts @@ -4,11 +4,11 @@ import { HttpInterceptorFn } from '@angular/common/http'; import { environment } from '../../../environments/environment'; +import { LoadingService } from '../services/loading/loading.service'; import { inject } from '@angular/core'; import { catchError, EMPTY, finalize } from 'rxjs'; import { Router } from '@angular/router'; import { ERROR_CODES, ERROR_PAGE_PATH } from '../../shared/constants/common.constant'; -import { LoadingService } from '../services/loading/loading.service'; export const REQUEST_BY = 'X-Requested-By'; export const IVY = 'marketplace-website'; diff --git a/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.spec.ts b/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.spec.ts index f0a81ac4..f1c431ff 100644 --- a/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.spec.ts +++ b/marketplace-ui/src/app/modules/product/product-detail/product-detail-version-action/product-detail-version-action.component.spec.ts @@ -15,7 +15,7 @@ import { ProductDetailActionType } from '../../../../shared/enums/product-detail import { MATOMO_TRACKING_ENVIRONMENT } from '../../../../shared/constants/matomo.constant'; class MockElementRef implements ElementRef { - nativeElement = { + nativeElement = { contains: jasmine.createSpy('contains') }; } @@ -292,64 +292,44 @@ describe('ProductDetailVersionActionComponent', () => { component.versions.set(['1.0', '1.1']); fixture.detectChanges(); component.getVersionInDesigner(); - expect( - productServiceMock.sendRequestToGetProductVersionsForDesigner - ).not.toHaveBeenCalled(); + expect(productServiceMock.sendRequestToGetProductVersionsForDesigner).not.toHaveBeenCalled(); }); it('should call productService and update versions if versions are empty', () => { const productId = '123'; component.versions.set([]); const mockVersions = [{ version: '1.0' }, { version: '2.0' }]; - productServiceMock.sendRequestToGetProductVersionsForDesigner.and.returnValue( - of(mockVersions) - ); + productServiceMock.sendRequestToGetProductVersionsForDesigner.and.returnValue(of(mockVersions)); // Act component.getVersionInDesigner(); // Assert - expect( - productServiceMock.sendRequestToGetProductVersionsForDesigner - ).toHaveBeenCalledWith(productId); + expect(productServiceMock.sendRequestToGetProductVersionsForDesigner).toHaveBeenCalledWith(productId); expect(component.versions()).toEqual(['Version 1.0', 'Version 2.0']); }); it('should handle empty response from productService', () => { component.versions.set([]); - productServiceMock.sendRequestToGetProductVersionsForDesigner.and.returnValue( - of([]) - ); + productServiceMock.sendRequestToGetProductVersionsForDesigner.and.returnValue(of([])); // Act component.getVersionInDesigner(); // Assert - expect( - productServiceMock.sendRequestToGetProductVersionsForDesigner - ).toHaveBeenCalledWith(productId); + expect(productServiceMock.sendRequestToGetProductVersionsForDesigner).toHaveBeenCalledWith(productId); expect(component.versions()).toEqual([]); }); it('should return the correct tracking environment based on the action type', () => { const testCases = [ - { - actionType: ProductDetailActionType.STANDARD, - expected: MATOMO_TRACKING_ENVIRONMENT.standard - }, - { - actionType: ProductDetailActionType.DESIGNER_ENV, - expected: MATOMO_TRACKING_ENVIRONMENT.designerEnv - }, - { - actionType: ProductDetailActionType.CUSTOM_SOLUTION, - expected: MATOMO_TRACKING_ENVIRONMENT.customSolution - } + { actionType: ProductDetailActionType.STANDARD, expected: MATOMO_TRACKING_ENVIRONMENT.standard }, + { actionType: ProductDetailActionType.DESIGNER_ENV, expected: MATOMO_TRACKING_ENVIRONMENT.designerEnv }, + { actionType: ProductDetailActionType.CUSTOM_SOLUTION, expected: MATOMO_TRACKING_ENVIRONMENT.customSolution } ]; testCases.forEach(({ actionType, expected }) => { component.actionType = actionType; - const result = component.getTrackingEnvironmentBasedOnActionType(); expect(result).toBe(expected); }); diff --git a/marketplace-ui/src/app/shared/mocks/mock-data.ts b/marketplace-ui/src/app/shared/mocks/mock-data.ts index 382329ef..e58cec92 100644 --- a/marketplace-ui/src/app/shared/mocks/mock-data.ts +++ b/marketplace-ui/src/app/shared/mocks/mock-data.ts @@ -355,10 +355,4 @@ export const MOCK_FEEDBACK_API_RESPONSE: FeedbackApiResponse = { totalPages: 1, number: 0 } -}; - -export const MOCK_RATING_STAR: StarRatingCounting[] = [ - { starRating: 0 }, - { starRating: 4 }, - { starRating: 3 } -]; +}; \ No newline at end of file