From 2174e549286a697a8c308f9ebe40da6d76461467 Mon Sep 17 00:00:00 2001 From: Charissa Miller <48832936+clemiller@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:26:20 -0400 Subject: [PATCH] fix tab tests to set latest version --- nav-app/karma.conf.js | 2 +- nav-app/src/app/tabs/tabs.component.spec.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nav-app/karma.conf.js b/nav-app/karma.conf.js index c79e5511c..8105c40c3 100755 --- a/nav-app/karma.conf.js +++ b/nav-app/karma.conf.js @@ -27,7 +27,7 @@ module.exports = function (config) { colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers: ['Chrome', 'ChromeHeadlessCI'], + browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessCI'], customLaunchers: { ChromeHeadlessCI: { base: 'ChromeHeadless', diff --git a/nav-app/src/app/tabs/tabs.component.spec.ts b/nav-app/src/app/tabs/tabs.component.spec.ts index 137ab0e6e..9ec31a1b5 100755 --- a/nav-app/src/app/tabs/tabs.component.spec.ts +++ b/nav-app/src/app/tabs/tabs.component.spec.ts @@ -457,6 +457,7 @@ describe('TabsComponent', () => { it('should create new layer from url', waitForAsync(() => { component.dataService.setUpDomains(MockData.configData.entries); + component.dataService.latestVersion = new Version('enterprise-attack-13', '13'); component.http = http; spyOn(component.http, 'get').and.returnValue(of(MockLayers.layerFile1)); spyOn(component.dataService, 'loadDomainData').and.returnValue(Promise.resolve()); @@ -466,6 +467,7 @@ describe('TabsComponent', () => { it('should read and open json file', waitForAsync(() => { component.dataService.setUpDomains(MockData.configData.entries); + component.dataService.latestVersion = new Version('enterprise-attack-13', '13'); let mockedDocElement = document.createElement('input'); mockedDocElement.id = 'uploader'; mockedDocElement.value = 'test1'; @@ -524,6 +526,7 @@ describe('TabsComponent', () => { component.openTab('layer1', vm2, true, true, true, true); expect(component.getScoreExpressionError()).toEqual('Layer b does not match the chosen domain'); component.dataService.setUpDomains(MockData.configData.entries); // set up data + component.dataService.latestVersion = new Version('enterprise-attack-13', '13'); component.opSettings.domain = 'enterprise-attack-13'; expect(component.getFilteredVMs()).toEqual(component.viewModelsService.viewModels); spyOn(component.dataService, 'loadDomainData').and.returnValue(Promise.resolve()); @@ -538,6 +541,7 @@ describe('TabsComponent', () => { component.openTab('layer', vm1, true, true, true, true); expect(component.getScoreExpressionError()).toEqual(null); component.dataService.setUpDomains(MockData.configData.entries); // set up data + component.dataService.latestVersion = new Version('enterprise-attack-13', '13'); component.dataService.parseBundles(component.dataService.getDomain('enterprise-attack-13'), MockData.stixBundleSDO); //load the data component.opSettings.domain = 'enterprise-attack-13'; spyOn(component.dataService, 'loadDomainData').and.returnValue(Promise.resolve()); @@ -554,6 +558,7 @@ describe('TabsComponent', () => { component.openTab('layer2', vm2, true, true, true, true); component.dataService.setUpDomains(MockData.configDataExtended.entries); // set up data + component.dataService.latestVersion = new Version('enterprise-attack-13', '13'); component.dataService.parseBundles(component.dataService.getDomain('enterprise-attack-13'), MockData.stixBundleSDO); //load the data component.opSettings.domain = 'enterprise-attack-13'; let alertSpy = spyOn(window, 'alert'); @@ -733,6 +738,7 @@ describe('TabsComponent', () => { }, ]; component.dataService.setUpDomains(versions); + component.dataService.latestVersion = new Version('mobile-attack-13', '13'); component.http = http; spyOn(component.http, 'get').and.returnValue(of(MockLayers.layerFile1)); let alertSpy = spyOn(window, 'alert');