[ACS-12441] unit tests fixes [link-adf:improvement/AAE-51237-upgrade-angular-to-v21][ci:force]

This commit is contained in:
Mykyta Maliarchuk
2026-09-15 16:03:54 +02:00
parent 5855187122
commit 53c42760b6
5 changed files with 29 additions and 15 deletions
@@ -67,6 +67,11 @@ describe('BulkActionsDropdownComponent', () => {
const getLabelText = (selector: string): string => getElement(selector).textContent.trim();
const getPlaceholderText = async (): Promise<string> => {
const selectHarness = await loader.getHarness(MatSelectHarness);
return selectHarness.getValueText();
};
const selectOptionFromDropdown = async (selectionIndex: number) => {
const selectHarness = await loader.getHarness(MatSelectHarness);
await selectHarness.open();
@@ -91,6 +96,7 @@ describe('BulkActionsDropdownComponent', () => {
component.items = [mockItem];
fixture.detectChanges();
loader = TestbedHarnessEnvironment.loader(fixture);
});
it('should create', () => {
@@ -109,8 +115,8 @@ describe('BulkActionsDropdownComponent', () => {
expect(dropdown.getAttribute('aria-disabled')).toBe('true');
});
it('should have correct placeholder', () => {
expect(getLabelText('aca-bulk-actions-dropdown')).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.BULK_NOT_AVAILABLE');
it('should have correct placeholder', async () => {
await expect(await getPlaceholderText()).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.BULK_NOT_AVAILABLE');
});
it('should call translationService.get with correct arguments', () => {
@@ -132,8 +138,8 @@ describe('BulkActionsDropdownComponent', () => {
expect(dropdown.getAttribute('aria-disabled')).toBe('false');
});
it('should have correct placeholder', () => {
expect(getLabelText('aca-bulk-actions-dropdown')).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.TITLE');
it('should have correct placeholder', async () => {
await expect(await getPlaceholderText()).toEqual('SEARCH.BULK_ACTIONS_DROPDOWN.TITLE');
});
it('should have option with correct tooltip', () => {
@@ -163,7 +169,6 @@ describe('BulkActionsDropdownComponent', () => {
extensionService = TestBed.inject(AppExtensionService);
spyOn(extensionService, 'getBulkActions').and.returnValue(of([mockItem]));
fixture.detectChanges();
loader = TestbedHarnessEnvironment.loader(fixture);
});
it('should run action on selection', async () => {
@@ -23,7 +23,7 @@
</div>
} @else {
<mat-progress-spinner
class="aca-page-layout-spinner"
class="aca-page-layout-content aca-page-layout-spinner"
data-automation-id="'saved-search-list-spinner'"
[color]="'primary'"
[mode]="'indeterminate'" />
@@ -138,8 +138,8 @@ describe('NodeInformationComponent', () => {
expect(getNumberOfFiles()).toBe('APP.NODE_INFO.CALCULATING');
expect(getNodeSize()).toBe('APP.NODE_INFO.CALCULATING');
expect(getNodeLocation()).toBe('mock-folder-path');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22PM');
});
it('should make API call on init to start folder size calculation', () => {
@@ -243,8 +243,8 @@ describe('NodeInformationComponent', () => {
expect(getNodeName()).toBe('mock-file');
expect(getNodeSize()).toBe('1000 CORE.FILE_SIZE.BYTES');
expect(getNodeLocation()).toBe('mock-file-path');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22PM');
});
it('should call API to fetch secondary parent paths', () => {
@@ -282,8 +282,8 @@ describe('NodeInformationComponent', () => {
expect(getNodeName()).toBe('mock-file-link');
expect(getNodeSize()).toBe('APP.NODE_INFO.NOT_AVAILABLE');
expect(getNodeLocation()).toBe('mock-file-link-path');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22PM');
expect(nodeService.initiateFolderSizeCalculation).not.toHaveBeenCalled();
});
@@ -296,8 +296,8 @@ describe('NodeInformationComponent', () => {
expect(getNodeSize()).toBe('APP.NODE_INFO.NOT_AVAILABLE');
expect(getNumberOfFiles()).toBe('APP.NODE_INFO.NOT_AVAILABLE');
expect(getNodeLocation()).toBe('mock-folder-link-path');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11 AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22 PM');
expect(getNodeCreationDate()).toBe('2/1/24, 11:11AM');
expect(getNodeModifyDate()).toBe('3/2/24, 10:22PM');
expect(nodeService.initiateFolderSizeCalculation).not.toHaveBeenCalled();
});
});
@@ -59,6 +59,10 @@ describe('ToolbarMenuItemComponent', () => {
appExtensionService = TestBed.inject(AppExtensionService);
});
afterEach(() => {
fixture.destroy();
});
it('should run action on click', async () => {
const runActionById = spyOn(appExtensionService, 'runActionById');
+6 -1
View File
@@ -26,10 +26,15 @@
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { getTestBed, TestBed } from '@angular/core/testing';
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
import { provideZoneChangeDetection } from '@angular/core';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {
teardown: { destroyAfterEach: false }
});
beforeEach(() => {
TestBed.configureTestingModule({ providers: [provideZoneChangeDetection()] });
});