Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
clemiller committed Feb 3, 2024
1 parent 9b6dcb6 commit a1ef7bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
26 changes: 13 additions & 13 deletions nav-app/src/app/services/data.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import * as MockData from '../../tests/utils/mock-data';
import { DataService } from './data.service';

describe('DataService', () => {
let dataService: DataService;
let dataService: DataService;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [DataService],
});
dataService = TestBed.inject(DataService);
dataService = TestBed.inject(DataService);
});

it('should be created', () => {
Expand Down Expand Up @@ -193,7 +193,7 @@ describe('DataService', () => {
expect(mitigation_test.relatedTechniques('enterprise-attack-13')).toEqual([]);
});

it('should test asset', ()=> {
it('should test asset', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
dataService.domains[0].relationships['targeted_assets'].set('asset-0', ['attack-pattern-0']);
Expand All @@ -203,7 +203,7 @@ describe('DataService', () => {
expect(asset_test.relatedTechniques('enterprise-attack-13')).toEqual([]);
});

it('should test campaign', ()=> {
it('should test campaign', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
dataService.domains[0].relationships['campaign_uses'].set('campaign-0', ['attack-pattern-0']);
Expand All @@ -213,7 +213,7 @@ describe('DataService', () => {
expect(campaign_test.relatedTechniques('enterprise-attack-13')).toEqual([]);
});

it('should test data components', ()=> {
it('should test data components', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
let t1 = new Technique(MockData.T0000, [], dataService);
Expand All @@ -233,7 +233,7 @@ describe('DataService', () => {
expect(data_component_test.techniques('enterprise-attack-13')).toEqual(['attack-pattern-0']);
});

it('should test group', ()=> {
it('should test group', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
dataService.domains[0].relationships['group_uses'].set('intrusion-set-0', ['attack-pattern-0']);
Expand All @@ -245,7 +245,7 @@ describe('DataService', () => {
expect(group_test.relatedTechniques('enterprise-attack-13')).toEqual([]);
});

it('should test stixObject', ()=> {
it('should test stixObject', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
let stixObject_test = new Campaign(MockData.G0000, dataService);
Expand All @@ -261,21 +261,21 @@ describe('DataService', () => {
expect(campaign_test.compareVersion(asset_test)).toEqual(0);
});

it('should test technique', ()=> {
it('should test technique', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
let technique_test = new Technique(MockData.T0002, [], dataService);
expect(technique_test.get_all_technique_tactic_ids()).toEqual([]);
});

it('should throw error if tactic does not exist', ()=> {
it('should throw error if tactic does not exist', () => {
let technique_test = new Technique(MockData.T0001, [], dataService);
expect(() => {
technique_test.get_technique_tactic_id('impact');
}).toThrowError();
});

it('should parse stix bundle', ()=> {
it('should parse stix bundle', () => {
dataService.subtechniquesEnabled = true; // enable to parse subs
dataService.setUpURLs(MockData.configData);
dataService.domains[0].relationships['group_uses'].set('intrusion-set-0', ['attack-pattern-0']);
Expand Down Expand Up @@ -324,7 +324,7 @@ describe('DataService', () => {
expect(relationships['targeted_assets'].size).toEqual(1);
});

it('should update domain watchers', ()=> {
it('should update domain watchers', () => {
let functionSpy = spyOn(dataService, 'getCurrentVersion');
dataService.setUpURLs(MockData.configData);
let domain = dataService.domains[0];
Expand All @@ -333,7 +333,7 @@ describe('DataService', () => {
expect(functionSpy).toHaveBeenCalled();
});

it('should compare the same version as unchanged', ()=> {
it('should compare the same version as unchanged', () => {
dataService.setUpURLs([]);
let domain = dataService.domains[0];
dataService.parseBundle(domain, MockData.stixBundleSDO);
Expand All @@ -345,7 +345,7 @@ describe('DataService', () => {
expect(result.unchanged.length).toEqual(4);
});

it('should compare versions', ()=> {
it('should compare versions', () => {
let newVersion = {
name: 'ATT&CK v14',
version: '14',
Expand Down
14 changes: 7 additions & 7 deletions nav-app/src/app/services/viewmodels.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ import tinygradient from 'tinygradient';
import * as MockData from '../../tests/utils/mock-data';

describe('ViewmodelsService', () => {
let viewModelsService: ViewModelsService;
let viewModelsService: ViewModelsService;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, MatDialogModule],
providers: [ViewModelsService],
});
viewModelsService = TestBed.inject(ViewModelsService);
viewModelsService = TestBed.inject(ViewModelsService);
});

it('should be created', () => {
expect(viewModelsService).toBeTruthy();
});

it('should correctly increment nonce on subsequent calls', () => {
expect(viewModelsService.getNonce()).toBe(0);
expect(viewModelsService.getNonce()).toBe(1);
expect(viewModelsService.getNonce()).toBe(2);
});
it('should correctly increment nonce on subsequent calls', () => {
expect(viewModelsService.getNonce()).toBe(0);
expect(viewModelsService.getNonce()).toBe(1);
expect(viewModelsService.getNonce()).toBe(2);
});

it('should create viewmodel by inheriting the score from other view models', () => {
viewModelsService.selectionChanged();
Expand Down

0 comments on commit a1ef7bf

Please sign in to comment.