Skip to content

Commit 3e28e1f

Browse files
committed
fix broken tests
1 parent cd87ee2 commit 3e28e1f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/app/component/activity-description/activity-description.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ <h1>
8787
</mat-expansion-panel-header>
8888
<mat-accordion multi="true">
8989
<mat-expansion-panel
90+
id="teamsEvidence"
9091
*ngFor="let item of this.currentActivity.teamsEvidence | keyvalue">
9192
<mat-expansion-panel-header>
9293
<mat-panel-title>
@@ -163,7 +164,7 @@ <h1>
163164
<b>References</b>
164165
</mat-panel-title>
165166
</mat-expansion-panel-header>
166-
<p>
167+
<p id="references">
167168
<mat-accordion multi="true">
168169
<mat-expansion-panel>
169170
<mat-expansion-panel-header>

src/app/component/activity-description/activity-description.component.spec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ describe('ActivityDescriptionComponent', () => {
9898
component.currentActivity.teamsEvidence = testEvidence;
9999
fixture.detectChanges();
100100
const HTMLElement: HTMLElement = fixture.nativeElement;
101-
const contentDisplayedinParagraphTag =
102-
HTMLElement.querySelector('#evidence')!;
103-
expect(contentDisplayedinParagraphTag.textContent).toContain(testEvidence);
101+
const parentElement = HTMLElement.querySelectorAll('#teamsEvidence')!;
102+
console.log('parentElement', parentElement[1].textContent);
103+
const lengthOfObject = Object.keys(testEvidence).length;
104+
for (var i = 0; i > lengthOfObject; i++)
105+
expect(parentElement[i].textContent).toContain(
106+
Object.keys(testEvidence)[i] + Object.values(testEvidence)[i]
107+
);
104108
});
105109

106110
it('check if assessment is being generated', () => {
@@ -138,8 +142,10 @@ describe('ActivityDescriptionComponent', () => {
138142

139143
fixture.detectChanges();
140144
const HTMLElement: HTMLElement = fixture.nativeElement;
141-
const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('p')!;
142-
expect(contentDisplayedinParagraphTag[10].textContent).toContain(
145+
const contentDisplayedinParagraphTag =
146+
HTMLElement.querySelectorAll('#references')!;
147+
148+
expect(contentDisplayedinParagraphTag[0].textContent).toContain(
143149
component.SAMMVersion +
144150
testSAMM[0] +
145151
component.ISOVersion +

0 commit comments

Comments
 (0)