From 06de2aecd6d74d5bbaa74ba1e322aac6ecf7b79c Mon Sep 17 00:00:00 2001 From: Dinh Nguyen Date: Thu, 29 Aug 2024 11:18:47 +0700 Subject: [PATCH] update test case --- .../product-detail.component.spec.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts b/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts index 51c7efa12..5a6199ffa 100644 --- a/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts +++ b/marketplace-ui/src/app/modules/product/product-detail/product-detail.component.spec.ts @@ -316,4 +316,22 @@ describe('ProductDetailComponent', () => { component.onResize(); expect(component.checkMediaSize).toHaveBeenCalled(); }); + + it('should be empty selected version if product detail content is missing', () => { + component.productModuleContent.set({} as ProductModuleContent); + component.selectedVersion = ''; + component.handleProductContentVersion(); + expect(component.selectedVersion).toEqual(''); + }); + + it('should be formated selected version if open in designer', () => { + const mockContent: ProductModuleContent = { + ...MOCK_PRODUCT_MODULE_CONTENT, + tag: '10.0.11' + }; + component.productModuleContent.set(mockContent); + routingQueryParamService.isDesignerEnv.and.returnValue(true); + component.handleProductContentVersion(); + expect(component.selectedVersion).toEqual('Version 10.0.11'); + }); });