Skip to content

Commit

Permalink
Merge pull request #320 from 0x41head/teams-evidence
Browse files Browse the repository at this point in the history
Added teamsEvidence
  • Loading branch information
wurstbrot authored Aug 20, 2024
2 parents 543dc5b + 2e49d65 commit 39ad80e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ testem.log
# System Files
.DS_Store
Thumbs.db

/src/assets/YAML/generated/generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,21 @@ <h1>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
<b>Evidence</b>
<b>Teams Evidence</b>
</mat-panel-title>
</mat-expansion-panel-header>
<p id="evidence" [innerHTML]="currentActivity.evidence"></p>
<mat-accordion multi="true">
<mat-expansion-panel
id="teamsEvidence"
*ngFor="let item of this.currentActivity.teamsEvidence | keyvalue">
<mat-expansion-panel-header>
<mat-panel-title>
<b [innerHTML]="item.key"></b>
</mat-panel-title>
</mat-expansion-panel-header>
<p [innerHTML]="item.value"></p>
</mat-expansion-panel>
</mat-accordion>
</mat-expansion-panel>

<mat-expansion-panel>
Expand Down Expand Up @@ -153,7 +164,7 @@ <h1>
<b>References</b>
</mat-panel-title>
</mat-expansion-panel-header>
<p>
<p id="references">
<mat-accordion multi="true">
<mat-expansion-panel>
<mat-expansion-panel-header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ describe('ActivityDescriptionComponent', () => {
});

it('check if evidence is being generated', () => {
const testEvidence = 'Sample Evidence';
component.currentActivity.evidence = testEvidence;
const testEvidence = { A: 'Sample Evidence', Default: 'Sample evidence 2' };
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', () => {
Expand Down Expand Up @@ -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 +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface activityDescription {
implementation: implementation[];
usefulness: number;
evidence: string;
teamsEvidence: Object;
assessment: string;
comments: string;
isImplemented: boolean;
Expand Down Expand Up @@ -67,6 +68,7 @@ export class ActivityDescriptionComponent implements OnInit {
usefulness: -1,
assessment: '',
evidence: '',
teamsEvidence: {},
comments: '',
isImplemented: false,
teamsImplemented: {},
Expand Down Expand Up @@ -261,6 +263,10 @@ export class ActivityDescriptionComponent implements OnInit {
false
);
this.currentActivity.teamsImplemented = data['teamsImplemented'];
this.currentActivity.teamsEvidence = this.defineEvidenceObject(
data['teamsEvidence']
);
// console.log("data['teamsEvidence']", data['teamsEvidence']);
this.openall();
});
}
Expand Down Expand Up @@ -309,6 +315,14 @@ export class ActivityDescriptionComponent implements OnInit {
}
}

defineEvidenceObject(dataToCheck: { [key: string]: string }): Object {
var dataToReturn: { [key: string]: string } = {};
for (var key in dataToCheck) {
dataToReturn[key] = this.defineStringValues(dataToCheck[key], '');
}
return dataToReturn;
}

defineImplementationObject(dataToCheck: implementation[]): implementation[] {
var dataToReturn: implementation[] = [];
for (var data in dataToCheck) {
Expand Down

0 comments on commit 39ad80e

Please sign in to comment.