From 3e28e1f3a8e8eb44ac18991a564ba9409ecb7399 Mon Sep 17 00:00:00 2001 From: Aryan Date: Fri, 16 Aug 2024 14:58:13 +0530 Subject: [PATCH] fix broken tests --- .../activity-description.component.html | 3 ++- .../activity-description.component.spec.ts | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/component/activity-description/activity-description.component.html b/src/app/component/activity-description/activity-description.component.html index 64a3f5ee..01955440 100644 --- a/src/app/component/activity-description/activity-description.component.html +++ b/src/app/component/activity-description/activity-description.component.html @@ -87,6 +87,7 @@

@@ -163,7 +164,7 @@

References -

+

diff --git a/src/app/component/activity-description/activity-description.component.spec.ts b/src/app/component/activity-description/activity-description.component.spec.ts index dca91d8f..f4ffe622 100644 --- a/src/app/component/activity-description/activity-description.component.spec.ts +++ b/src/app/component/activity-description/activity-description.component.spec.ts @@ -98,9 +98,13 @@ describe('ActivityDescriptionComponent', () => { component.currentActivity.teamsEvidence = testEvidence; fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = - HTMLElement.querySelector('#evidence')!; - expect(contentDisplayedinParagraphTag.textContent).toContain(testEvidence); + const parentElement = HTMLElement.querySelectorAll('#teamsEvidence')!; + console.log('parentElement', parentElement[1].textContent); + const lengthOfObject = Object.keys(testEvidence).length; + for (var i = 0; i > lengthOfObject; i++) + expect(parentElement[i].textContent).toContain( + Object.keys(testEvidence)[i] + Object.values(testEvidence)[i] + ); }); it('check if assessment is being generated', () => { @@ -138,8 +142,10 @@ describe('ActivityDescriptionComponent', () => { fixture.detectChanges(); const HTMLElement: HTMLElement = fixture.nativeElement; - const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!; - expect(contentDisplayedinParagraphTag[10].textContent).toContain( + const contentDisplayedinParagraphTag = + HTMLElement.querySelectorAll('#references')!; + + expect(contentDisplayedinParagraphTag[0].textContent).toContain( component.SAMMVersion + testSAMM[0] + component.ISOVersion +