Skip to content

Commit

Permalink
sonarcloud stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
clemiller committed Feb 2, 2024
1 parent 684ecc0 commit 5858454
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
3 changes: 0 additions & 3 deletions nav-app/src/app/services/viewmodels.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ describe('ViewmodelsService', () => {
let stvm_1 = new TechniqueVM("T1595.002^reconnaissance");
let tvm_2 = new TechniqueVM("T1592^reconnaissance");
tvm_1.score = "3";
vm1.sidebarOpened;
vm1.setTechniqueVM(tvm_1);
vm1.setTechniqueVM(tvm_2);
vm1.setTechniqueVM(stvm_1);
Expand Down Expand Up @@ -831,8 +830,6 @@ describe('ViewmodelsService', () => {
]
let vm1 = service.newViewModel("test1","enterprise-attack-13");
vm1.dataService.setUpURLs(versions);
let idToTacticSDO = new Map<string, any>();
idToTacticSDO.set("tactic-0", tacticSDO);
let tvm_1 = new TechniqueVM("T1595^reconnaissance");
let l1 = new Link();
l1.label = "test1";
Expand Down
3 changes: 2 additions & 1 deletion nav-app/src/app/svg-export/svg-export.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, inject, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { SvgExportComponent } from './svg-export.component';
Expand Down Expand Up @@ -412,6 +412,7 @@ describe('SvgExportComponent', () => {

it('should handle negative values gracefully', () => {
const spacing = component['getSpacing'](-100, -4);
expect(spacing.length).toEqual(0);
});

});
Expand Down
26 changes: 4 additions & 22 deletions nav-app/src/app/tabs/tabs.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, fakeAsync, flush, inject, tick, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed, fakeAsync, flush, waitForAsync } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TabsComponent } from './tabs.component';
import { MatDialogModule, MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
Expand All @@ -16,9 +16,6 @@ import { Subscription, of } from 'rxjs';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Technique } from '../classes/stix';

const mockSnackbarMock = jasmine.createSpyObj(['open']);
mockSnackbarMock.open

describe('TabsComponent', () => {
let component: TabsComponent;
let fixture: ComponentFixture<TabsComponent>;
Expand Down Expand Up @@ -680,16 +677,11 @@ describe('TabsComponent', () => {
let component = fixture.debugElement.componentInstance;
component.opSettings.scoreExpression = "a+b";
component.opSettings.domain = "enterprise-atack-13";
let scoreVariables = new Map<string, ViewModel>();
let vm1 = component.viewModelsService.newViewModel("layer","ics-attack-13");
let vm2 = component.viewModelsService.newViewModel("layer1","ics-attack-13");
component.openTab('layer', vm1, true, true, true, true);
component.openTab('layer1', vm2, true, true, true, true);
expect(component.getScoreExpressionError()).toEqual('Layer b does not match the chosen domain');
let vm1_name = component.indexToChar(0);
let vm2_name = component.indexToChar(1);
scoreVariables.set(vm1_name,vm1);
scoreVariables.set(vm2_name,vm2);
let versions = [
{
"name": "ATT&CK v13",
Expand All @@ -714,9 +706,7 @@ describe('TabsComponent', () => {
it('should create new layer by operation based on user input when data is loaded', async () => {
let component = fixture.debugElement.componentInstance;
component.opSettings.scoreExpression = "a+2";
let scoreVariables = new Map<string, ViewModel>();
let vm1 = component.viewModelsService.newViewModel("layer","enterprise-attack-13");
scoreVariables.set("a",vm1);
component.openTab('layer', vm1, true, true, true, true);
expect(component.getScoreExpressionError()).toEqual(null);
component.dataService.setUpURLs(versions); // set up data
Expand All @@ -734,7 +724,7 @@ describe('TabsComponent', () => {
}));

it('should copy link', (fakeAsync (() => {
var mockedDocElement = document.createElement('input');
let mockedDocElement = document.createElement('input');
mockedDocElement.id = 'layerLink';
mockedDocElement.value = 'test1';
mockedDocElement.type = "text";
Expand All @@ -746,7 +736,7 @@ describe('TabsComponent', () => {
})));

it('should open upload prompt', (fakeAsync (() => {
var mockedDocElement = document.createElement('input');
let mockedDocElement = document.createElement('input');
mockedDocElement.id = 'uploader';
mockedDocElement.value = 'test1';
mockedDocElement.type = "text";
Expand Down Expand Up @@ -821,7 +811,7 @@ describe('TabsComponent', () => {
]
}]
component.dataService.setUpURLs(versions);
var mockedDocElement = document.createElement('input');
let mockedDocElement = document.createElement('input');
mockedDocElement.id = 'uploader';
mockedDocElement.value = 'test1';
mockedDocElement.type = "text";
Expand Down Expand Up @@ -1052,8 +1042,6 @@ describe('TabsComponent', () => {
component.dataService.parseBundle(component.dataService.getDomain("enterprise-attack-13"), bundles);
let layer = JSON.parse(JSON.stringify(layer_file1))
let vm1 = component.viewModelsService.newViewModel("layer2","enterprise-attack-13");
let idToTacticSDO = new Map<string, any>();
idToTacticSDO.set("tactic-0", tacticSDO);
let st1 = new Technique(subtechniqueSDO1,[],null);
let t1 = new Technique(techniqueSDO,[st1],null);
let tvm_1 = new TechniqueVM("T1592^reconnaissance");
Expand Down Expand Up @@ -1147,8 +1135,6 @@ describe('TabsComponent', () => {
component.dataService.setUpURLs(versions);
let vm1 = component.viewModelsService.newViewModel("layer2","enterprise-attack-13");
vm1.version = '13';
let idToTacticSDO = new Map<string, any>();
idToTacticSDO.set("tactic-0", tacticSDO);
let st1 = new Technique(subtechniqueSDO1,[],null);
let t1 = new Technique(techniqueSDO,[st1],null);
let t2 = new Technique(techniqueSDO2,[],null);
Expand Down Expand Up @@ -1186,8 +1172,6 @@ describe('TabsComponent', () => {
let component = fixture.debugElement.componentInstance;
component.dataService.setUpURLs(versions);
let vm1 = component.viewModelsService.newViewModel("layer2","enterprise-attack-13");
let idToTacticSDO = new Map<string, any>();
idToTacticSDO.set("tactic-0", tacticSDO);
let t1 = new Technique(techniqueSDO,[],null);
let t2 = new Technique(techniqueSDO2,[],null);
let tvm_1 = new TechniqueVM("T1595^reconnaissance");
Expand Down Expand Up @@ -1370,10 +1354,8 @@ describe('TabsComponent', () => {
let component = fixture.debugElement.componentInstance;
component.opSettings.scoreExpression = "a+b+2";
expect(component.getScoreExpressionError()).toEqual('Variable b does not match any layers');
let scoreVariables = new Map<string, ViewModel>();
let vm1 = component.viewModelsService.newViewModel("layer","enterprise-attack-13");
let vm2 = component.viewModelsService.newViewModel("layer","enterprise-attack-12");
scoreVariables.set("a",vm1);
component.openTab('layer', vm1, true, true, true, true);
component.openTab('layer2', vm2, true, true, true, true);

Expand Down

0 comments on commit 5858454

Please sign in to comment.